home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / GameCreators / TADS / manuals / TEX / TADSSMPL.TEX < prev    next >
LaTeX Document  |  1992-11-13  |  16.1 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: TADSSMPL.TEX

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document, ASCII text, with CRLF line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried x-fmt/111 Plain Text File default
100% detectItEasy Format: plain text[CRLF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 24 48 65 61 64 65 | 72 3a 20 63 3a 2f 74 61 |% $Heade|r: c:/ta|
|00000010| 64 73 2f 64 6f 63 2f 52 | 43 53 2f 74 61 64 73 73 |ds/doc/R|CS/tadss|
|00000020| 6d 70 6c 2e 74 65 78 20 | 31 2e 32 20 39 32 2f 31 |mpl.tex |1.2 92/1|
|00000030| 31 2f 31 33 20 31 36 3a | 34 35 3a 31 36 20 6d 72 |1/13 16:|45:16 mr|
|00000040| 6f 62 65 72 74 73 20 45 | 78 70 20 24 0d 0a 25 20 |oberts E|xp $..% |
|00000050| 54 41 44 53 20 64 6f 63 | 75 6d 65 6e 74 61 74 69 |TADS doc|umentati|
|00000060| 6f 6e 2c 20 43 68 61 70 | 74 65 72 20 4f 6e 65 3a |on, Chap|ter One:|
|00000070| 20 20 41 20 53 61 6d 70 | 6c 65 20 47 61 6d 65 0d | A Samp|le Game.|
|00000080| 0a 25 0d 0a 25 20 43 6f | 70 79 72 69 67 68 74 20 |.%..% Co|pyright |
|00000090| 28 63 29 20 31 39 38 39 | 20 62 79 20 4d 69 63 68 |(c) 1989| by Mich|
|000000a0| 61 65 6c 20 4a 2e 20 52 | 6f 62 65 72 74 73 2e 20 |ael J. R|oberts. |
|000000b0| 20 41 6c 6c 20 52 69 67 | 68 74 73 20 52 65 73 65 | All Rig|hts Rese|
|000000c0| 72 76 65 64 2e 0d 0a 25 | 0d 0a 0d 0a 5c 63 68 61 |rved...%|....\cha|
|000000d0| 70 74 65 72 68 65 61 64 | 65 72 7b 43 68 61 70 74 |pterhead|er{Chapt|
|000000e0| 65 72 20 4f 6e 65 7d 7b | 41 20 53 61 6d 70 6c 65 |er One}{|A Sample|
|000000f0| 20 47 61 6d 65 7d 7b 31 | 7d 0d 0a 0d 0a 54 68 69 | Game}{1|}....Thi|
|00000100| 73 20 73 65 63 74 69 6f | 6e 20 69 6e 74 72 6f 64 |s sectio|n introd|
|00000110| 75 63 65 73 20 6d 61 6e | 79 20 6f 66 20 74 68 65 |uces man|y of the|
|00000120| 20 63 6f 6e 63 65 70 74 | 73 20 6f 66 20 77 72 69 | concept|s of wri|
|00000130| 74 69 6e 67 20 61 20 54 | 41 44 53 20 70 72 6f 67 |ting a T|ADS prog|
|00000140| 72 61 6d 0d 0a 62 79 20 | 65 78 70 6c 61 69 6e 69 |ram..by |explaini|
|00000150| 6e 67 20 68 6f 77 20 61 | 20 73 69 6d 70 6c 65 20 |ng how a| simple |
|00000160| 65 78 61 6d 70 6c 65 20 | 77 6f 72 6b 73 2e 20 20 |example |works. |
|00000170| 54 68 65 20 63 68 61 70 | 74 65 72 20 73 74 61 72 |The chap|ter star|
|00000180| 74 73 20 77 69 74 68 20 | 61 0d 0a 76 65 72 79 20 |ts with |a..very |
|00000190| 62 61 73 69 63 20 54 41 | 44 53 20 70 72 6f 67 72 |basic TA|DS progr|
|000001a0| 61 6d 2c 20 74 6f 20 64 | 65 6d 6f 6e 73 74 72 61 |am, to d|emonstra|
|000001b0| 74 65 20 74 68 65 20 67 | 65 6e 65 72 61 6c 20 73 |te the g|eneral s|
|000001c0| 74 72 75 63 74 75 72 65 | 20 6f 66 20 61 20 67 61 |tructure| of a ga|
|000001d0| 6d 65 2c 0d 0a 74 68 65 | 6e 20 65 78 70 61 6e 64 |me,..the|n expand|
|000001e0| 73 20 69 74 20 74 6f 20 | 73 68 6f 77 20 6d 6f 72 |s it to |show mor|
|000001f0| 65 20 66 65 61 74 75 72 | 65 73 20 6f 66 20 74 68 |e featur|es of th|
|00000200| 65 20 6c 61 6e 67 75 61 | 67 65 2e 20 20 41 6c 74 |e langua|ge. Alt|
|00000210| 68 6f 75 67 68 20 74 68 | 65 0d 0a 65 78 61 6d 70 |hough th|e..examp|
|00000220| 6c 65 20 69 73 20 76 65 | 72 79 20 73 69 6d 70 6c |le is ve|ry simpl|
|00000230| 65 2c 20 69 74 20 69 73 | 20 61 20 63 6f 6d 70 6c |e, it is| a compl|
|00000240| 65 74 65 2c 20 77 6f 72 | 6b 69 6e 67 20 54 41 44 |ete, wor|king TAD|
|00000250| 53 20 70 72 6f 67 72 61 | 6d 2e 0d 0a 0d 0a 57 65 |S progra|m.....We|
|00000260| 20 61 72 65 20 73 74 61 | 72 74 69 6e 67 20 77 69 | are sta|rting wi|
|00000270| 74 68 20 61 20 73 61 6d | 70 6c 65 20 67 61 6d 65 |th a sam|ple game|
|00000280| 20 62 65 63 61 75 73 65 | 20 69 74 20 70 72 6f 76 | because| it prov|
|00000290| 69 64 65 73 20 61 6e 20 | 6f 76 65 72 76 69 65 77 |ides an |overview|
|000002a0| 0d 0a 6f 66 20 68 6f 77 | 20 61 20 54 41 44 53 20 |..of how| a TADS |
|000002b0| 70 72 6f 67 72 61 6d 20 | 66 69 74 73 20 74 6f 67 |program |fits tog|
|000002c0| 65 74 68 65 72 2e 20 20 | 57 68 65 6e 20 79 6f 75 |ether. |When you|
|000002d0| 20 61 72 65 20 72 65 61 | 64 69 6e 67 20 6c 61 74 | are rea|ding lat|
|000002e0| 65 72 20 73 65 63 74 69 | 6f 6e 73 2c 0d 0a 77 68 |er secti|ons,..wh|
|000002f0| 69 63 68 20 64 65 73 63 | 72 69 62 65 20 74 68 65 |ich desc|ribe the|
|00000300| 20 65 6c 65 6d 65 6e 74 | 73 20 6f 66 20 74 68 65 | element|s of the|
|00000310| 20 6c 61 6e 67 75 61 67 | 65 20 69 6e 20 64 65 74 | languag|e in det|
|00000320| 61 69 6c 2c 20 69 74 20 | 6d 61 79 20 62 65 20 68 |ail, it |may be h|
|00000330| 65 6c 70 66 75 6c 0d 0a | 74 6f 20 68 61 76 65 20 |elpful..|to have |
|00000340| 61 6e 20 69 64 65 61 20 | 6f 66 20 77 68 65 72 65 |an idea |of where|
|00000350| 20 74 68 65 20 64 65 74 | 61 69 6c 73 20 66 69 74 | the det|ails fit|
|00000360| 20 69 6e 74 6f 20 74 68 | 65 20 67 65 6e 65 72 61 | into th|e genera|
|00000370| 6c 20 73 74 72 75 63 74 | 75 72 65 20 6f 66 0d 0a |l struct|ure of..|
|00000380| 61 20 67 61 6d 65 2e 20 | 20 54 68 69 73 20 63 68 |a game. | This ch|
|00000390| 61 70 74 65 72 20 73 68 | 6f 75 6c 64 20 68 65 6c |apter sh|ould hel|
|000003a0| 70 20 70 72 6f 76 69 64 | 65 20 74 68 61 74 20 6f |p provid|e that o|
|000003b0| 76 65 72 76 69 65 77 2e | 5c 62 75 6c 6c 0d 0a 0d |verview.|\bull...|
|000003c0| 0a 5c 63 68 61 70 74 65 | 72 62 6f 64 79 0d 0a 0d |.\chapte|rbody...|
|000003d0| 0a 5c 6d 61 6a 6f 72 73 | 65 63 74 69 6f 6e 7b 41 |.\majors|ection{A|
|000003e0| 20 56 65 72 79 20 53 69 | 6d 70 6c 65 20 47 61 6d | Very Si|mple Gam|
|000003f0| 65 7d 0d 0a 0d 0a 57 65 | 27 6c 6c 20 73 74 61 72 |e}....We|'ll star|
|00000400| 74 20 77 69 74 68 20 61 | 62 6f 75 74 20 74 68 65 |t with a|bout the|
|00000410| 20 73 69 6d 70 6c 65 73 | 74 20 67 61 6d 65 20 70 | simples|t game p|
|00000420| 6f 73 73 69 62 6c 65 3a | 0d 0a 74 77 6f 20 72 6f |ossible:|..two ro|
|00000430| 6f 6d 73 2c 20 61 6e 64 | 20 6e 6f 20 6f 62 6a 65 |oms, and| no obje|
|00000440| 63 74 73 2e 20 20 28 57 | 65 20 63 6f 75 6c 64 20 |cts. (W|e could |
|00000450| 63 6f 6e 63 65 69 76 61 | 62 6c 79 20 73 74 61 72 |conceiva|bly star|
|00000460| 74 20 77 69 74 68 20 6f | 6e 6c 79 20 6f 6e 65 20 |t with o|nly one |
|00000470| 72 6f 6f 6d 2c 0d 0a 74 | 6f 20 6d 61 6b 65 20 74 |room,..t|o make t|
|00000480| 68 69 6e 67 73 20 65 76 | 65 6e 20 73 69 6d 70 6c |hings ev|en simpl|
|00000490| 65 72 2c 20 62 75 74 20 | 74 68 65 6e 20 74 68 65 |er, but |then the|
|000004a0| 72 65 20 77 6f 75 6c 64 | 20 62 65 20 6e 6f 74 68 |re would| be noth|
|000004b0| 69 6e 67 20 74 6f 20 64 | 6f 20 77 68 69 6c 65 0d |ing to d|o while.|
|000004c0| 0a 70 6c 61 79 69 6e 67 | 20 74 68 65 20 67 61 6d |.playing| the gam|
|000004d0| 65 3b 20 77 69 74 68 20 | 74 77 6f 20 72 6f 6f 6d |e; with |two room|
|000004e0| 73 2c 20 77 65 20 61 74 | 20 6c 65 61 73 74 20 63 |s, we at| least c|
|000004f0| 61 6e 20 6d 6f 76 65 20 | 62 65 74 77 65 65 6e 20 |an move |between |
|00000500| 74 68 65 6d 2e 29 0d 0a | 0d 0a 49 66 20 79 6f 75 |them.)..|..If you|
|00000510| 20 77 61 6e 74 20 74 6f | 20 74 72 79 20 72 75 6e | want to| try run|
|00000520| 6e 69 6e 67 20 74 68 69 | 73 20 67 61 6d 65 2c 20 |ning thi|s game, |
|00000530| 63 72 65 61 74 65 20 61 | 20 66 69 6c 65 20 77 69 |create a| file wi|
|00000540| 74 68 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 74 |th the p|rogram t|
|00000550| 65 78 74 20 61 73 0d 0a | 73 68 6f 77 6e 20 62 65 |ext as..|shown be|
|00000560| 6c 6f 77 20 75 73 69 6e | 67 20 79 6f 75 72 20 74 |low usin|g your t|
|00000570| 65 78 74 20 65 64 69 74 | 6f 72 20 6f 72 20 77 6f |ext edit|or or wo|
|00000580| 72 64 20 70 72 6f 63 65 | 73 73 6f 72 2e 20 20 54 |rd proce|ssor. T|
|00000590| 68 65 20 54 41 44 53 20 | 5e 7b 43 6f 6d 70 69 6c |he TADS |^{Compil|
|000005a0| 65 72 7d 0d 0a 77 69 6c | 6c 20 61 63 63 65 70 74 |er}..wil|l accept|
|000005b0| 20 61 6e 20 5e 7b 41 53 | 43 49 49 7d 20 66 69 6c | an ^{AS|CII} fil|
|000005c0| 65 20 70 72 6f 64 75 63 | 65 64 20 77 69 74 68 20 |e produc|ed with |
|000005d0| 61 6e 79 20 65 64 69 74 | 6f 72 2e 0d 0a 0d 0a 7b |any edit|or.....{|
|000005e0| 5c 65 78 61 6d 70 6c 65 | 0d 0a 20 20 20 2f 2a 20 |\example|.. /* |
|000005f0| 54 68 69 73 20 69 73 20 | 61 20 63 6f 6d 6d 65 6e |This is |a commen|
|00000600| 74 2c 20 6a 75 73 74 20 | 6c 69 6b 65 20 69 6e 20 |t, just |like in |
|00000610| 43 20 2a 2f 0d 0a 0d 0a | 20 20 20 5c 23 69 6e 63 |C */....| \#inc|
|00000620| 6c 75 64 65 20 3c 61 64 | 76 2e 74 3e 20 20 20 20 |lude <ad|v.t> |
|00000630| 20 20 20 20 20 20 20 5c | 68 66 69 6c 6c 2f 2a 20 | \|hfill/* |
|00000640| 72 65 61 64 20 67 65 6e | 65 72 69 63 20 61 64 76 |read gen|eric adv|
|00000650| 65 6e 74 75 72 65 20 67 | 61 6d 65 20 22 61 64 76 |enture g|ame "adv|
|00000660| 2e 74 22 20 2a 2f 0d 0a | 20 20 20 5c 23 69 6e 63 |.t" */..| \#inc|
|00000670| 6c 75 64 65 20 3c 73 74 | 64 2e 74 3e 20 20 20 20 |lude <st|d.t> |
|00000680| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 5c | | \|
|00000690| 68 66 69 6c 6c 2f 2a 20 | 72 65 61 64 20 73 74 61 |hfill/* |read sta|
|000006a0| 6e 64 61 72 64 20 75 6e | 64 65 72 70 69 6e 6e 69 |ndard un|derpinni|
|000006b0| 6e 67 73 20 2a 2f 0d 0a | 20 20 20 20 5c 6d 65 64 |ngs */..| \med|
|000006c0| 73 6b 69 70 0d 0a 20 20 | 20 20 20 5c 6f 62 6a 65 |skip.. | \obje|
|000006d0| 63 74 7b 73 74 61 72 74 | 72 6f 6f 6d 3a 20 72 6f |ct{start|room: ro|
|000006e0| 6f 6d 20 5c 68 66 69 6c | 6c 2f 2a 20 74 68 65 20 |om \hfil|l/* the |
|000006f0| 67 61 6d 65 20 61 6c 77 | 61 79 73 20 73 74 61 72 |game alw|ays star|
|00000700| 74 73 20 69 6e 20 22 73 | 74 61 72 74 72 6f 6f 6d |ts in "s|tartroom|
|00000710| 22 20 2a 2f 7d 0d 0a 20 | 20 20 20 20 20 20 20 73 |" */}.. | s|
|00000720| 64 65 73 63 20 3d 20 22 | 4f 75 74 73 69 64 65 20 |desc = "|Outside |
|00000730| 63 61 76 65 22 20 20 5c | 68 66 69 6c 6c 2f 2a 20 |cave" \|hfill/* |
|00000740| 74 68 65 20 22 53 68 6f | 72 74 20 44 45 53 43 72 |the "Sho|rt DESCr|
|00000750| 69 70 74 69 6f 6e 22 20 | 6f 66 20 74 68 65 20 72 |iption" |of the r|
|00000760| 6f 6f 6d 20 2a 2f 0d 0a | 09 6c 64 65 73 63 20 3d |oom */..|.ldesc =|
|00000770| 20 22 59 6f 75 27 72 65 | 20 73 74 61 6e 64 69 6e | "You're| standin|
|00000780| 67 20 69 6e 20 74 68 65 | 20 62 72 69 67 68 74 20 |g in the| bright |
|00000790| 73 75 6e 6c 69 67 68 74 | 20 6a 75 73 74 0d 0a 09 |sunlight| just...|
|000007a0| 20 20 5c 69 6e 64 65 6e | 74 20 6f 75 74 73 69 64 | \inden|t outsid|
|000007b0| 65 20 6f 66 20 61 20 6c | 61 72 67 65 2c 20 64 61 |e of a l|arge, da|
|000007c0| 72 6b 2c 20 66 6f 72 62 | 6f 64 69 6e 67 20 63 61 |rk, forb|oding ca|
|000007d0| 76 65 2c 20 77 68 69 63 | 68 0d 0a 09 20 20 5c 69 |ve, whic|h... \i|
|000007e0| 6e 64 65 6e 74 20 6c 69 | 65 73 20 74 6f 20 74 68 |ndent li|es to th|
|000007f0| 65 20 6e 6f 72 74 68 2e | 20 22 0d 0a 09 6e 6f 72 |e north.| "...nor|
|00000800| 74 68 20 3d 20 63 61 76 | 65 20 20 20 20 20 20 5c |th = cav|e \|
|00000810| 68 66 69 6c 6c 20 2f 2a | 20 74 68 65 20 72 6f 6f |hfill /*| the roo|
|00000820| 6d 20 63 61 6c 6c 65 64 | 20 22 63 61 76 65 22 20 |m called| "cave" |
|00000830| 6c 69 65 73 20 74 6f 20 | 74 68 65 20 6e 6f 72 74 |lies to |the nort|
|00000840| 68 20 2a 2f 0d 0a 20 20 | 20 5c 65 6e 64 6f 62 6a |h */.. | \endobj|
|00000850| 0d 0a 0d 0a 20 20 20 5c | 6f 62 6a 65 63 74 7b 63 |.... \|object{c|
|00000860| 61 76 65 3a 20 72 6f 6f | 6d 7d 20 20 20 20 0d 0a |ave: roo|m} ..|
|00000870| 20 20 20 20 20 20 20 20 | 73 64 65 73 63 20 3d 20 | |sdesc = |
|00000880| 22 43 61 76 65 22 0d 0a | 09 6c 64 65 73 63 20 3d |"Cave"..|.ldesc =|
|00000890| 20 22 59 6f 75 27 72 65 | 20 69 6e 73 69 64 65 20 | "You're| inside |
|000008a0| 61 20 64 61 72 6b 20 61 | 6e 64 20 6d 75 73 74 79 |a dark a|nd musty|
|000008b0| 20 63 61 76 65 2e 20 53 | 75 6e 6c 69 67 68 74 0d | cave. S|unlight.|
|000008c0| 0a 09 20 20 5c 69 6e 64 | 65 6e 74 20 70 6f 75 72 |.. \ind|ent pour|
|000008d0| 73 20 69 6e 20 66 72 6f | 6d 20 61 20 70 61 73 73 |s in fro|m a pass|
|000008e0| 61 67 65 20 74 6f 20 74 | 68 65 20 73 6f 75 74 68 |age to t|he south|
|000008f0| 2e 20 22 0d 0a 09 73 6f | 75 74 68 20 3d 20 73 74 |. "...so|uth = st|
|00000900| 61 72 74 72 6f 6f 6d 0d | 0a 20 20 20 5c 65 6e 64 |artroom.|. \end|
|00000910| 6f 62 6a 0d 0a 7d 0d 0a | 0d 0a 54 6f 20 72 75 6e |obj..}..|..To run|
|00000920| 20 74 68 69 73 20 65 78 | 61 6d 70 6c 65 2c 0d 0a | this ex|ample,..|
|00000930| 61 6c 6c 20 79 6f 75 20 | 68 61 76 65 20 74 6f 20 |all you |have to |
|00000940| 64 6f 20 69 73 20 63 6f | 6d 70 69 6c 65 20 69 74 |do is co|mpile it|
|00000950| 20 77 69 74 68 20 7b 5c | 74 74 20 74 63 7d 2c 20 | with {\|tt tc}, |
|00000960| 74 68 65 20 54 41 44 53 | 20 43 6f 6d 70 69 6c 65 |the TADS| Compile|
|00000970| 72 2c 0d 0a 61 6e 64 20 | 72 75 6e 20 69 74 20 77 |r,..and |run it w|
|00000980| 69 74 68 20 7b 5c 74 74 | 20 74 72 7d 2c 20 74 68 |ith {\tt| tr}, th|
|00000990| 65 20 54 41 44 53 20 5e | 7b 52 75 6e 2d 74 69 6d |e TADS ^|{Run-tim|
|000009a0| 65 20 73 79 73 74 65 6d | 7d 2e 0d 0a 49 66 20 79 |e system|}...If y|
|000009b0| 6f 75 20 6e 61 6d 65 64 | 20 79 6f 75 72 20 73 61 |ou named| your sa|
|000009c0| 6d 70 6c 65 0d 0a 70 72 | 6f 67 72 61 6d 20 7b 5c |mple..pr|ogram {\|
|000009d0| 74 74 20 73 61 6d 70 6c | 65 2e 74 7d 2c 20 6f 6e |tt sampl|e.t}, on|
|000009e0| 20 6d 6f 73 74 20 6f 70 | 65 72 61 74 69 6e 67 20 | most op|erating |
|000009f0| 73 79 73 74 65 6d 73 20 | 79 6f 75 20 63 61 6e 20 |systems |you can |
|00000a00| 63 6f 6d 70 69 6c 65 20 | 79 6f 75 72 0d 0a 67 61 |compile |your..ga|
|00000a10| 6d 65 20 62 79 20 74 79 | 70 69 6e 67 20 74 68 69 |me by ty|ping thi|
|00000a20| 73 3a 0d 0a 0d 0a 7b 5c | 65 78 61 6d 70 6c 65 20 |s:....{\|example |
|00000a30| 74 63 20 73 61 6d 70 6c | 65 20 5c 6d 65 64 73 6b |tc sampl|e \medsk|
|00000a40| 69 70 7d 0d 0a 20 20 20 | 20 0d 0a 5c 6e 6f 69 6e |ip}.. | ..\noin|
|00000a50| 64 65 6e 74 20 61 6e 64 | 20 79 6f 75 20 63 61 6e |dent and| you can|
|00000a60| 20 72 75 6e 20 69 74 20 | 62 79 20 74 79 70 69 6e | run it |by typin|
|00000a70| 67 20 74 68 69 73 3a 0d | 0a 0d 0a 7b 5c 65 78 61 |g this:.|...{\exa|
|00000a80| 6d 70 6c 65 20 74 72 20 | 73 61 6d 70 6c 65 20 5c |mple tr |sample \|
|00000a90| 6d 65 64 73 6b 69 70 7d | 0d 0a 0d 0a 5c 6e 6f 69 |medskip}|....\noi|
|00000aa0| 6e 64 65 6e 74 20 54 68 | 6f 73 65 20 74 77 6f 20 |ndent Th|ose two |
|00000ab0| 63 6f 6d 6d 61 6e 64 73 | 2d 2d 2d 7b 5c 74 74 20 |commands|---{\tt |
|00000ac0| 74 63 7d 20 61 6e 64 20 | 7b 5c 74 74 20 74 72 7d |tc} and |{\tt tr}|
|00000ad0| 2d 2d 2d 61 72 65 20 74 | 68 65 20 6f 6e 6c 79 20 |---are t|he only |
|00000ae0| 6f 70 65 72 61 74 69 6e | 67 0d 0a 73 79 73 74 65 |operatin|g..syste|
|00000af0| 6d 0d 0a 63 6f 6d 6d 61 | 6e 64 73 20 79 6f 75 27 |m..comma|nds you'|
|00000b00| 6c 6c 20 6e 65 65 64 20 | 74 6f 20 6c 65 61 72 6e |ll need |to learn|
|00000b10| 20 74 6f 20 77 72 69 74 | 65 20 67 61 6d 65 73 2c | to writ|e games,|
|00000b20| 20 61 70 61 72 74 20 66 | 72 6f 6d 20 74 68 65 20 | apart f|rom the |
|00000b30| 63 6f 6d 6d 61 6e 64 73 | 20 79 6f 75 0d 0a 75 73 |commands| you..us|
|00000b40| 65 20 74 6f 20 72 75 6e | 20 79 6f 75 72 20 74 65 |e to run| your te|
|00000b50| 78 74 20 65 64 69 74 6f | 72 20 61 6e 64 20 6f 70 |xt edito|r and op|
|00000b60| 65 72 61 74 69 6e 67 20 | 73 79 73 74 65 6d 20 75 |erating |system u|
|00000b70| 74 69 6c 69 74 69 65 73 | 2e 0d 0a 0d 0a 4e 6f 77 |tilities|.....Now|
|00000b80| 20 77 65 27 6c 6c 20 77 | 61 6c 6b 20 74 68 72 6f | we'll w|alk thro|
|00000b90| 75 67 68 20 74 68 65 20 | 73 61 6d 70 6c 65 20 67 |ugh the |sample g|
|00000ba0| 61 6d 65 20 6c 69 6e 65 | 20 62 79 20 6c 69 6e 65 |ame line| by line|
|00000bb0| 2e 0d 0a 0d 0a 54 68 65 | 20 7b 5c 74 74 20 5e 7b |.....The| {\tt ^{|
|00000bc0| 5c 23 69 6e 63 6c 75 64 | 65 7d 7d 20 63 6f 6d 6d |\#includ|e}} comm|
|00000bd0| 61 6e 64 20 69 6e 73 65 | 72 74 73 20 61 6e 6f 74 |and inse|rts anot|
|00000be0| 68 65 72 20 73 6f 75 72 | 63 65 20 66 69 6c 65 20 |her sour|ce file |
|00000bf0| 69 6e 74 6f 20 79 6f 75 | 72 20 70 72 6f 67 72 61 |into you|r progra|
|00000c00| 6d 2e 0d 0a 54 68 65 20 | 66 69 6c 65 20 63 61 6c |m...The |file cal|
|00000c10| 6c 65 64 20 7b 5c 74 74 | 20 5e 7b 61 64 76 2e 74 |led {\tt| ^{adv.t|
|00000c20| 7d 7d 20 69 73 20 61 20 | 73 65 74 20 6f 66 20 62 |}} is a |set of b|
|00000c30| 61 73 69 63 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |asic def|initions|
|00000c40| 20 63 6f 6d 6d 6f 6e 20 | 74 6f 20 6d 6f 73 74 0d | common |to most.|
|00000c50| 0a 61 64 76 65 6e 74 75 | 72 65 73 2e 20 20 59 6f |.adventu|res. Yo|
|00000c60| 75 20 73 68 6f 75 6c 64 | 20 62 65 20 61 62 6c 65 |u should| be able|
|00000c70| 20 74 6f 20 75 73 65 20 | 74 68 65 73 65 20 64 65 | to use |these de|
|00000c80| 66 69 6e 69 74 69 6f 6e | 73 2c 20 77 69 74 68 20 |finition|s, with |
|00000c90| 66 65 77 20 63 68 61 6e | 67 65 73 2c 0d 0a 66 6f |few chan|ges,..fo|
|00000ca0| 72 20 6d 6f 73 74 20 61 | 64 76 65 6e 74 75 72 65 |r most a|dventure|
|00000cb0| 20 67 61 6d 65 73 2e 20 | 20 42 79 20 69 6e 63 6c | games. | By incl|
|00000cc0| 75 64 69 6e 67 20 7b 5c | 74 74 20 61 64 76 2e 74 |uding {\|tt adv.t|
|00000cd0| 7d 20 69 6e 20 79 6f 75 | 72 20 67 61 6d 65 2c 20 |} in you|r game, |
|00000ce0| 79 6f 75 0d 0a 64 6f 6e | 27 74 20 6e 65 65 64 20 |you..don|'t need |
|00000cf0| 74 6f 20 77 6f 72 72 79 | 20 61 62 6f 75 74 20 64 |to worry| about d|
|00000d00| 65 66 69 6e 69 74 69 6f | 6e 73 20 66 6f 72 20 62 |efinitio|ns for b|
|00000d10| 61 73 69 63 20 77 6f 72 | 64 73 20 73 75 63 68 20 |asic wor|ds such |
|00000d20| 61 73 20 60 60 74 68 65 | 2c 22 20 61 0d 0a 6c 61 |as ``the|," a..la|
|00000d30| 72 67 65 20 73 65 74 20 | 6f 66 20 76 65 72 62 73 |rge set |of verbs|
|00000d40| 20 28 73 75 63 68 20 61 | 73 20 60 60 74 61 6b 65 | (such a|s ``take|
|00000d50| 2c 22 20 60 60 6e 6f 72 | 74 68 2c 22 20 61 6e 64 |," ``nor|th," and|
|00000d60| 20 73 6f 20 66 6f 72 74 | 68 29 2c 20 61 6e 64 20 | so fort|h), and |
|00000d70| 6d 61 6e 79 0d 0a 6f 62 | 6a 65 63 74 20 63 6c 61 |many..ob|ject cla|
|00000d80| 73 73 65 73 20 28 6d 6f | 72 65 20 6f 6e 20 74 68 |sses (mo|re on th|
|00000d90| 65 73 65 20 69 6e 20 61 | 20 62 69 74 29 2e 0d 0a |ese in a| bit)...|
|00000da0| 0d 0a 54 68 65 20 6c 69 | 6e 65 20 69 6e 63 6c 75 |..The li|ne inclu|
|00000db0| 64 69 6e 67 20 7b 5c 74 | 74 20 5e 7b 73 74 64 2e |ding {\t|t ^{std.|
|00000dc0| 74 7d 7d 20 69 73 20 73 | 69 6d 69 6c 61 72 3b 20 |t}} is s|imilar; |
|00000dd0| 69 74 20 63 6f 6e 74 61 | 69 6e 73 20 73 6f 6d 65 |it conta|ins some|
|00000de0| 20 61 64 64 69 74 69 6f | 6e 61 6c 0d 0a 73 74 61 | additio|nal..sta|
|00000df0| 6e 64 61 72 64 20 64 65 | 66 69 6e 69 74 69 6f 6e |ndard de|finition|
|00000e00| 73 2e 20 20 54 68 65 20 | 72 65 61 73 6f 6e 20 66 |s. The |reason f|
|00000e10| 6f 72 20 70 6c 61 63 69 | 6e 67 20 74 68 65 73 65 |or placi|ng these|
|00000e20| 20 64 65 66 69 6e 69 74 | 69 6f 6e 73 20 69 6e 20 | definit|ions in |
|00000e30| 61 20 73 65 70 61 72 61 | 74 65 0d 0a 66 69 6c 65 |a separa|te..file|
|00000e40| 20 69 73 20 74 68 61 74 | 20 74 68 65 79 20 77 69 | is that| they wi|
|00000e50| 6c 6c 20 75 73 75 61 6c | 6c 79 20 62 65 20 63 75 |ll usual|ly be cu|
|00000e60| 73 74 6f 6d 69 7a 65 64 | 20 69 6e 20 61 20 66 69 |stomized| in a fi|
|00000e70| 6e 69 73 68 65 64 0d 0a | 67 61 6d 65 2e 20 20 57 |nished..|game. W|
|00000e80| 68 65 6e 20 79 6f 75 27 | 72 65 20 69 6e 20 74 68 |hen you'|re in th|
|00000e90| 65 20 66 69 6e 61 6c 20 | 73 74 61 67 65 73 20 6f |e final |stages o|
|00000ea0| 66 20 70 6f 6c 69 73 68 | 69 6e 67 20 79 6f 75 72 |f polish|ing your|
|00000eb0| 20 67 61 6d 65 2c 20 79 | 6f 75 27 6c 6c 0d 0a 75 | game, y|ou'll..u|
|00000ec0| 73 75 61 6c 6c 79 20 77 | 61 6e 74 20 74 6f 20 72 |sually w|ant to r|
|00000ed0| 65 6d 6f 76 65 20 74 68 | 65 20 7b 5c 74 74 20 73 |emove th|e {\tt s|
|00000ee0| 74 64 2e 74 7d 20 64 65 | 66 69 6e 69 74 69 6f 6e |td.t} de|finition|
|00000ef0| 73 20 61 6e 64 20 75 73 | 65 20 79 6f 75 72 20 6f |s and us|e your o|
|00000f00| 77 6e 0d 0a 28 66 6f 72 | 20 65 78 61 6d 70 6c 65 |wn..(for| example|
|00000f10| 2c 20 79 6f 75 20 77 69 | 6c 6c 20 70 72 6f 62 61 |, you wi|ll proba|
|00000f20| 62 6c 79 20 72 65 70 6c | 61 63 65 20 74 68 65 20 |bly repl|ace the |
|00000f30| 7b 5c 74 74 20 69 6e 69 | 74 7d 20 66 75 6e 63 74 |{\tt ini|t} funct|
|00000f40| 69 6f 6e 20 69 6e 0d 0a | 7b 5c 74 74 20 73 74 64 |ion in..|{\tt std|
|00000f50| 2e 74 7d 20 77 69 74 68 | 20 79 6f 75 72 20 6f 77 |.t} with| your ow|
|00000f60| 6e 20 76 65 72 73 69 6f | 6e 20 77 68 69 63 68 20 |n versio|n which |
|00000f70| 64 69 73 70 6c 61 79 73 | 20 61 6e 20 69 6e 74 72 |displays| an intr|
|00000f80| 6f 64 75 63 74 6f 72 79 | 0d 0a 6d 65 73 73 61 67 |oductory|..messag|
|00000f90| 65 20 61 70 70 72 6f 70 | 72 69 61 74 65 20 66 6f |e approp|riate fo|
|00000fa0| 72 20 79 6f 75 72 20 67 | 61 6d 65 29 2e 20 20 48 |r your g|ame). H|
|00000fb0| 6f 77 65 76 65 72 2c 20 | 74 68 65 20 64 65 66 69 |owever, |the defi|
|00000fc0| 6e 69 74 69 6f 6e 73 20 | 69 6e 0d 0a 7b 5c 74 74 |nitions |in..{\tt|
|00000fd0| 20 73 74 64 2e 74 7d 20 | 61 72 65 20 67 6f 6f 64 | std.t} |are good|
|00000fe0| 20 65 6e 6f 75 67 68 20 | 74 6f 20 6c 65 74 20 79 | enough |to let y|
|00000ff0| 6f 75 20 67 65 74 20 73 | 74 61 72 74 65 64 20 77 |ou get s|tarted w|
|00001000| 69 74 68 20 61 20 67 61 | 6d 65 2e 0d 0a 0d 0a 54 |ith a ga|me.....T|
|00001010| 68 65 20 6c 69 6e 65 20 | 74 68 61 74 20 73 61 79 |he line |that say|
|00001020| 73 20 7b 5c 74 74 20 73 | 74 61 72 74 72 6f 6f 6d |s {\tt s|tartroom|
|00001030| 3a 20 72 6f 6f 6d 7d 20 | 74 65 6c 6c 73 20 74 68 |: room} |tells th|
|00001040| 65 20 63 6f 6d 70 69 6c | 65 72 20 74 68 61 74 20 |e compil|er that |
|00001050| 79 6f 75 27 72 65 0d 0a | 67 6f 69 6e 67 20 74 6f |you're..|going to|
|00001060| 20 64 65 66 69 6e 65 20 | 61 20 72 6f 6f 6d 20 6e | define |a room n|
|00001070| 61 6d 65 64 20 60 60 73 | 74 61 72 74 72 6f 6f 6d |amed ``s|tartroom|
|00001080| 22 2e 20 20 4e 6f 77 2c | 20 61 20 7b 5c 74 74 20 |". Now,| a {\tt |
|00001090| 72 6f 6f 6d 7d 20 69 73 | 20 6e 6f 74 68 69 6e 67 |room} is| nothing|
|000010a0| 0d 0a 73 70 65 63 69 61 | 6c 20 74 6f 20 54 41 44 |..specia|l to TAD|
|000010b0| 53 2c 20 62 75 74 20 74 | 68 65 20 66 69 6c 65 20 |S, but t|he file |
|000010c0| 7b 5c 74 74 20 61 64 76 | 2e 74 7d 20 74 68 61 74 |{\tt adv|.t} that|
|000010d0| 20 79 6f 75 20 69 6e 63 | 6c 75 64 65 64 20 64 65 | you inc|luded de|
|000010e0| 66 69 6e 65 73 20 77 68 | 61 74 0d 0a 61 20 7b 5c |fines wh|at..a {\|
|000010f0| 74 74 20 72 6f 6f 6d 7d | 20 69 73 2e 20 20 41 20 |tt room}| is. A |
|00001100| 7b 5c 74 74 20 72 6f 6f | 6d 7d 20 69 73 20 6f 6e |{\tt roo|m} is on|
|00001110| 65 20 6f 66 20 74 68 6f | 73 65 20 6f 62 6a 65 63 |e of tho|se objec|
|00001120| 74 20 63 6c 61 73 73 65 | 73 20 77 65 20 6d 65 6e |t classe|s we men|
|00001130| 74 69 6f 6e 65 64 2e 0d | 0a 54 68 65 20 6e 65 78 |tioned..|.The nex|
|00001140| 74 20 6c 69 6e 65 20 64 | 65 66 69 6e 65 73 20 74 |t line d|efines t|
|00001150| 68 65 20 7b 5c 74 74 20 | 5e 7b 73 64 65 73 63 7d |he {\tt |^{sdesc}|
|00001160| 7d 20 66 6f 72 20 74 68 | 69 73 20 72 6f 6f 6d 2e |} for th|is room.|
|00001170| 20 20 41 6e 20 7b 5c 74 | 74 20 73 64 65 73 63 7d | An {\t|t sdesc}|
|00001180| 0d 0a 69 73 20 61 20 73 | 68 6f 72 74 20 64 65 73 |..is a s|hort des|
|00001190| 63 72 69 70 74 69 6f 6e | 3b 20 66 6f 72 20 61 20 |cription|; for a |
|000011a0| 72 6f 6f 6d 2c 20 69 74 | 20 69 73 20 6e 6f 72 6d |room, it| is norm|
|000011b0| 61 6c 6c 79 20 64 69 73 | 70 6c 61 79 65 64 20 77 |ally dis|played w|
|000011c0| 68 65 6e 65 76 65 72 0d | 0a 61 20 70 6c 61 79 65 |henever.|.a playe|
|000011d0| 72 20 65 6e 74 65 72 73 | 20 74 68 65 20 72 6f 6f |r enters| the roo|
|000011e0| 6d 2e 20 20 54 68 65 20 | 7b 5c 74 74 20 5e 7b 6c |m. The |{\tt ^{l|
|000011f0| 64 65 73 63 7d 7d 20 69 | 73 20 74 68 65 20 6c 6f |desc}} i|s the lo|
|00001200| 6e 67 20 64 65 73 63 72 | 69 70 74 69 6f 6e 3b 20 |ng descr|iption; |
|00001210| 69 74 20 69 73 0d 0a 6e | 6f 72 6d 61 6c 6c 79 20 |it is..n|ormally |
|00001220| 64 69 73 70 6c 61 79 65 | 64 20 74 68 65 20 66 69 |displaye|d the fi|
|00001230| 72 73 74 20 74 69 6d 65 | 20 61 20 70 6c 61 79 65 |rst time| a playe|
|00001240| 72 20 65 6e 74 65 72 73 | 20 74 68 65 20 72 6f 6f |r enters| the roo|
|00001250| 6d 2c 20 61 6e 64 20 63 | 61 6e 20 62 65 0d 0a 64 |m, and c|an be..d|
|00001260| 69 73 70 6c 61 79 65 64 | 20 62 79 20 74 68 65 20 |isplayed| by the |
|00001270| 70 6c 61 79 65 72 20 62 | 79 20 74 79 70 69 6e 67 |player b|y typing|
|00001280| 20 60 60 6c 6f 6f 6b 22 | 2e 20 20 46 69 6e 61 6c | ``look"|. Final|
|00001290| 6c 79 2c 20 74 68 65 20 | 7b 5c 74 74 20 6e 6f 72 |ly, the |{\tt nor|
|000012a0| 74 68 7d 0d 0a 64 65 66 | 69 6e 69 74 69 6f 6e 20 |th}..def|inition |
|000012b0| 73 61 79 73 20 74 68 61 | 74 20 61 6e 6f 74 68 65 |says tha|t anothe|
|000012c0| 72 20 72 6f 6f 6d 2c 20 | 63 61 6c 6c 65 64 20 7b |r room, |called {|
|000012d0| 5c 74 74 20 63 61 76 65 | 7d 2c 20 69 73 20 72 65 |\tt cave|}, is re|
|000012e0| 61 63 68 65 64 20 77 68 | 65 6e 20 74 68 65 0d 0a |ached wh|en the..|
|000012f0| 70 6c 61 79 65 72 20 74 | 79 70 65 73 20 60 60 6e |player t|ypes ``n|
|00001300| 6f 72 74 68 22 20 77 68 | 69 6c 65 20 69 6e 20 7b |orth" wh|ile in {|
|00001310| 5c 74 74 20 73 74 61 72 | 74 72 6f 6f 6d 7d 2e 0d |\tt star|troom}..|
|00001320| 0a 0d 0a 41 20 62 69 74 | 20 6f 66 20 74 65 72 6d |...A bit| of term|
|00001330| 69 6e 6f 6c 6f 67 79 3a | 20 20 7b 5c 74 74 20 73 |inology:| {\tt s|
|00001340| 74 61 72 74 72 6f 6f 6d | 7d 20 61 6e 64 20 7b 5c |tartroom|} and {\|
|00001350| 74 74 20 63 61 76 65 7d | 20 61 72 65 20 7b 5c 73 |tt cave}| are {\s|
|00001360| 6c 20 6f 62 6a 65 63 74 | 73 7d 2c 0d 0a 62 65 6c |l object|s},..bel|
|00001370| 6f 6e 67 69 6e 67 20 74 | 6f 20 74 68 65 20 7b 5c |onging t|o the {\|
|00001380| 73 6c 20 63 6c 61 73 73 | 7d 5c 2f 20 7b 5c 74 74 |sl class|}\/ {\tt|
|00001390| 20 72 6f 6f 6d 7d 3b 20 | 7b 5c 74 74 20 73 64 65 | room}; |{\tt sde|
|000013a0| 73 63 7d 2c 20 7b 5c 74 | 74 20 6c 64 65 73 63 7d |sc}, {\t|t ldesc}|
|000013b0| 2c 0d 0a 7b 5c 74 74 20 | 6e 6f 72 74 68 7d 2c 0d |,..{\tt |north},.|
|000013c0| 0a 61 6e 64 20 74 68 65 | 20 6c 69 6b 65 20 61 72 |.and the| like ar|
|000013d0| 65 20 7b 5c 73 6c 20 5e | 7b 70 72 6f 70 65 72 74 |e {\sl ^|{propert|
|000013e0| 69 65 73 7d 7d 20 6f 66 | 20 74 68 65 69 72 20 72 |ies}} of| their r|
|000013f0| 65 73 70 65 63 74 69 76 | 65 20 6f 62 6a 65 63 74 |espectiv|e object|
|00001400| 73 2e 20 20 49 6e 20 74 | 68 65 0d 0a 63 6f 6e 74 |s. In t|he..cont|
|00001410| 65 78 74 20 6f 66 20 54 | 41 44 53 20 70 72 6f 67 |ext of T|ADS prog|
|00001420| 72 61 6d 6d 69 6e 67 2c | 20 61 6e 20 6f 62 6a 65 |ramming,| an obje|
|00001430| 63 74 20 69 73 20 61 20 | 6e 61 6d 65 64 20 65 6e |ct is a |named en|
|00001440| 74 69 74 79 20 77 68 69 | 63 68 20 69 73 20 64 65 |tity whi|ch is de|
|00001450| 66 69 6e 65 64 0d 0a 6c | 69 6b 65 20 7b 5c 74 74 |fined..l|ike {\tt|
|00001460| 20 73 74 61 72 74 72 6f | 6f 6d 7d 3b 20 65 61 63 | startro|om}; eac|
|00001470| 68 20 6f 62 6a 65 63 74 | 20 68 61 73 20 61 20 63 |h object| has a c|
|00001480| 6c 61 73 73 2c 20 77 68 | 69 63 68 20 64 65 66 69 |lass, wh|ich defi|
|00001490| 6e 65 73 20 68 6f 77 20 | 74 68 65 20 6f 62 6a 65 |nes how |the obje|
|000014a0| 63 74 0d 0a 62 65 68 61 | 76 65 73 20 61 6e 64 20 |ct..beha|ves and |
|000014b0| 77 68 61 74 20 6b 69 6e | 64 20 6f 66 20 64 61 74 |what kin|d of dat|
|000014c0| 61 20 69 74 20 63 6f 6e | 74 61 69 6e 73 2e 20 20 |a it con|tains. |
|000014d0| 4e 6f 74 65 20 74 68 61 | 74 20 6f 75 72 20 75 73 |Note tha|t our us|
|000014e0| 61 67 65 20 69 73 20 73 | 6f 6d 65 74 69 6d 65 73 |age is s|ometimes|
|000014f0| 0d 0a 61 20 6c 69 74 74 | 6c 65 20 6c 6f 6f 73 65 |..a litt|le loose|
|00001500| 2c 20 61 6e 64 20 77 65 | 20 77 69 6c 6c 20 61 6c |, and we| will al|
|00001510| 73 6f 20 75 73 65 20 60 | 60 6f 62 6a 65 63 74 22 |so use `|`object"|
|00001520| 20 74 68 65 20 77 61 79 | 20 61 20 70 6c 61 79 65 | the way| a playe|
|00001530| 72 20 77 6f 75 6c 64 2c | 20 74 6f 0d 0a 72 65 66 |r would,| to..ref|
|00001540| 65 72 20 74 6f 20 73 6f | 6d 65 74 68 69 6e 67 20 |er to so|mething |
|00001550| 69 6e 20 74 68 65 20 67 | 61 6d 65 20 74 68 61 74 |in the g|ame that|
|00001560| 20 61 20 70 6c 61 79 65 | 72 20 63 61 6e 20 6d 61 | a playe|r can ma|
|00001570| 6e 69 70 75 6c 61 74 65 | 2e 20 20 49 6e 20 66 61 |nipulate|. In fa|
|00001580| 63 74 2c 0d 0a 65 61 63 | 68 20 69 74 65 6d 20 74 |ct,..eac|h item t|
|00001590| 68 61 74 20 74 68 65 20 | 70 6c 61 79 65 72 20 74 |hat the |player t|
|000015a0| 68 69 6e 6b 73 20 6f 66 | 20 61 73 20 61 6e 20 6f |hinks of| as an o|
|000015b0| 62 6a 65 63 74 20 69 73 | 20 61 63 74 75 61 6c 6c |bject is| actuall|
|000015c0| 79 20 72 65 70 72 65 73 | 65 6e 74 65 64 0d 0a 62 |y repres|ented..b|
|000015d0| 79 20 61 20 54 41 44 53 | 20 6f 62 6a 65 63 74 20 |y a TADS| object |
|000015e0| 28 73 6f 6d 65 74 69 6d | 65 73 20 73 65 76 65 72 |(sometim|es sever|
|000015f0| 61 6c 2c 20 69 6e 20 66 | 61 63 74 29 3b 20 62 75 |al, in f|act); bu|
|00001600| 74 20 79 6f 75 72 20 54 | 41 44 53 20 70 72 6f 67 |t your T|ADS prog|
|00001610| 72 61 6d 20 77 69 6c 6c | 0d 0a 63 6f 6e 74 61 69 |ram will|..contai|
|00001620| 6e 20 6d 61 6e 79 20 6f | 62 6a 65 63 74 73 20 74 |n many o|bjects t|
|00001630| 68 61 74 20 74 68 65 20 | 70 6c 61 79 65 72 20 64 |hat the |player d|
|00001640| 6f 65 73 6e 27 74 20 64 | 69 72 65 63 74 6c 79 20 |oesn't d|irectly |
|00001650| 6d 61 6e 69 70 75 6c 61 | 74 65 2c 20 73 75 63 68 |manipula|te, such|
|00001660| 20 61 73 0d 0a 72 6f 6f | 6d 73 2e 0d 0a 0d 0a 49 | as..roo|ms.....I|
|00001670| 66 20 79 6f 75 20 61 72 | 65 20 66 61 6d 69 6c 69 |f you ar|e famili|
|00001680| 61 72 20 77 69 74 68 20 | 6f 74 68 65 72 20 70 72 |ar with |other pr|
|00001690| 6f 67 72 61 6d 6d 69 6e | 67 20 6c 61 6e 67 75 61 |ogrammin|g langua|
|000016a0| 67 65 73 2c 20 79 6f 75 | 20 6d 61 79 20 6e 6f 74 |ges, you| may not|
|000016b0| 69 63 65 20 74 68 61 74 | 20 74 68 65 0d 0a 70 72 |ice that| the..pr|
|000016c0| 6f 67 72 61 6d 20 61 62 | 6f 76 65 20 61 70 70 65 |ogram ab|ove appe|
|000016d0| 61 72 73 20 74 6f 20 62 | 65 20 65 6e 74 69 72 65 |ars to b|e entire|
|000016e0| 6c 79 20 64 65 66 69 6e | 69 74 69 6f 6e 73 20 6f |ly defin|itions o|
|000016f0| 66 20 6f 62 6a 65 63 74 | 73 3b 20 79 6f 75 20 6d |f object|s; you m|
|00001700| 61 79 20 77 6f 6e 64 65 | 72 0d 0a 77 68 65 72 65 |ay wonde|r..where|
|00001710| 20 74 68 65 20 70 72 6f | 67 72 61 6d 20 73 74 61 | the pro|gram sta|
|00001720| 72 74 73 20 72 75 6e 6e | 69 6e 67 2e 20 20 54 68 |rts runn|ing. Th|
|00001730| 65 20 61 6e 73 77 65 72 | 20 69 73 20 74 68 61 74 |e answer| is that|
|00001740| 20 74 68 65 20 70 72 6f | 67 72 61 6d 20 64 6f 65 | the pro|gram doe|
|00001750| 73 6e 27 74 0d 0a 68 61 | 76 65 20 61 20 62 65 67 |sn't..ha|ve a beg|
|00001760| 69 6e 6e 69 6e 67 2c 20 | 65 78 61 63 74 6c 79 2e |inning, |exactly.|
|00001770| 0d 0a 0d 0a 54 41 44 53 | 20 69 73 20 61 20 64 69 |....TADS| is a di|
|00001780| 66 66 65 72 65 6e 74 20 | 73 74 79 6c 65 20 6f 66 |fferent |style of|
|00001790| 20 70 72 6f 67 72 61 6d | 6d 69 6e 67 20 74 68 61 | program|ming tha|
|000017a0| 6e 20 79 6f 75 20 68 61 | 76 65 20 65 6e 63 6f 75 |n you ha|ve encou|
|000017b0| 6e 74 65 72 65 64 20 62 | 65 66 6f 72 65 3b 0d 0a |ntered b|efore;..|
|000017c0| 74 68 69 73 20 6e 65 77 | 20 73 74 79 6c 65 20 6d |this new| style m|
|000017d0| 61 79 20 74 61 6b 65 20 | 61 20 6c 69 74 74 6c 65 |ay take |a little|
|000017e0| 20 67 65 74 74 69 6e 67 | 20 75 73 65 64 20 74 6f | getting| used to|
|000017f0| 2c 20 62 75 74 20 79 6f | 75 20 77 69 6c 6c 20 66 |, but yo|u will f|
|00001800| 69 6e 64 20 74 68 61 74 | 20 69 74 0d 0a 69 73 20 |ind that| it..is |
|00001810| 71 75 69 74 65 20 70 6f | 77 65 72 66 75 6c 20 66 |quite po|werful f|
|00001820| 6f 72 20 77 72 69 74 69 | 6e 67 20 61 64 76 65 6e |or writi|ng adven|
|00001830| 74 75 72 65 20 67 61 6d | 65 73 20 61 6e 64 20 73 |ture gam|es and s|
|00001840| 69 6d 70 6c 69 66 69 65 | 73 20 74 68 65 20 74 61 |implifie|s the ta|
|00001850| 73 6b 0d 0a 63 6f 6e 73 | 69 64 65 72 61 62 6c 79 |sk..cons|iderably|
|00001860| 2e 20 20 4d 6f 73 74 20 | 70 72 6f 67 72 61 6d 6d |. Most |programm|
|00001870| 69 6e 67 20 6c 61 6e 67 | 75 61 67 65 73 20 61 72 |ing lang|uages ar|
|00001880| 65 20 60 60 70 72 6f 63 | 65 64 75 72 61 6c 22 3b |e ``proc|edural";|
|00001890| 20 79 6f 75 20 73 70 65 | 63 69 66 79 0d 0a 61 20 | you spe|cify..a |
|000018a0| 73 65 72 69 65 73 20 6f | 66 20 73 74 65 70 73 20 |series o|f steps |
|000018b0| 74 68 61 74 20 74 68 65 | 20 63 6f 6d 70 75 74 65 |that the| compute|
|000018c0| 72 20 65 78 65 63 75 74 | 65 73 20 69 6e 20 73 65 |r execut|es in se|
|000018d0| 71 75 65 6e 63 65 2e 20 | 54 41 44 53 2c 20 6f 6e |quence. |TADS, on|
|000018e0| 20 74 68 65 20 6f 74 68 | 65 72 0d 0a 68 61 6e 64 | the oth|er..hand|
|000018f0| 2c 20 69 73 20 6d 6f 72 | 65 20 60 60 64 65 63 6c |, is mor|e ``decl|
|00001900| 61 72 61 74 69 76 65 22 | 3b 20 79 6f 75 20 64 65 |arative"|; you de|
|00001910| 73 63 72 69 62 65 20 6f | 62 6a 65 63 74 73 20 74 |scribe o|bjects t|
|00001920| 6f 20 74 68 65 20 73 79 | 73 74 65 6d 2e 20 57 68 |o the sy|stem. Wh|
|00001930| 69 6c 65 20 54 41 44 53 | 0d 0a 70 72 6f 67 72 61 |ile TADS|..progra|
|00001940| 6d 73 20 75 73 75 61 6c | 6c 79 20 68 61 76 65 20 |ms usual|ly have |
|00001950| 70 72 6f 63 65 64 75 72 | 61 6c 20 73 65 63 74 69 |procedur|al secti|
|00001960| 6f 6e 73 2c 20 69 6e 20 | 77 68 69 63 68 20 73 74 |ons, in |which st|
|00001970| 65 70 73 20 61 72 65 20 | 65 78 65 63 75 74 65 64 |eps are |executed|
|00001980| 20 69 6e 0d 0a 73 65 71 | 75 65 6e 63 65 2c 20 74 | in..seq|uence, t|
|00001990| 68 65 20 6f 76 65 72 61 | 6c 6c 20 70 72 6f 67 72 |he overa|ll progr|
|000019a0| 61 6d 20 64 6f 65 73 6e | 27 74 20 68 61 76 65 20 |am doesn|'t have |
|000019b0| 61 20 62 65 67 69 6e 6e | 69 6e 67 20 6f 72 20 61 |a beginn|ing or a|
|000019c0| 6e 20 65 6e 64 2e 0d 0a | 0d 0a 54 68 65 20 72 65 |n end...|..The re|
|000019d0| 61 73 6f 6e 20 54 41 44 | 53 20 70 72 6f 67 72 61 |ason TAD|S progra|
|000019e0| 6d 73 20 61 72 65 6e 27 | 74 20 70 72 6f 63 65 64 |ms aren'|t proced|
|000019f0| 75 72 61 6c 20 69 73 20 | 74 68 61 74 20 74 68 65 |ural is |that the|
|00001a00| 20 70 6c 61 79 65 72 20 | 69 73 20 61 6c 77 61 79 | player |is alway|
|00001a10| 73 20 69 6e 0d 0a 63 6f | 6e 74 72 6f 6c 20 6f 66 |s in..co|ntrol of|
|00001a20| 20 74 68 65 20 67 61 6d | 65 2e 20 20 57 68 65 6e | the gam|e. When|
|00001a30| 20 74 68 65 20 67 61 6d | 65 20 66 69 72 73 74 20 | the gam|e first |
|00001a40| 73 74 61 72 74 73 2c 20 | 74 68 65 20 73 79 73 74 |starts, |the syst|
|00001a50| 65 6d 20 63 61 6c 6c 73 | 20 61 20 62 69 74 0d 0a |em calls| a bit..|
|00001a60| 6f 66 20 70 72 6f 63 65 | 64 75 72 61 6c 20 63 6f |of proce|dural co|
|00001a70| 64 65 20 69 6e 20 79 6f | 75 72 20 70 72 6f 67 72 |de in yo|ur progr|
|00001a80| 61 6d 20 74 68 61 74 20 | 64 69 73 70 6c 61 79 73 |am that |displays|
|00001a90| 20 61 6e 79 20 69 6e 74 | 72 6f 64 75 63 74 6f 72 | any int|roductor|
|00001aa0| 79 20 74 65 78 74 20 79 | 6f 75 0d 0a 77 69 73 68 |y text y|ou..wish|
|00001ab0| 20 74 68 65 20 70 6c 61 | 79 65 72 20 74 6f 20 73 | the pla|yer to s|
|00001ac0| 65 65 2c 20 74 68 65 6e | 20 74 68 65 20 73 79 73 |ee, then| the sys|
|00001ad0| 74 65 6d 20 77 61 69 74 | 73 20 66 6f 72 20 61 20 |tem wait|s for a |
|00001ae0| 63 6f 6d 6d 61 6e 64 20 | 66 72 6f 6d 20 74 68 65 |command |from the|
|00001af0| 20 70 6c 61 79 65 72 2e | 0d 0a 42 61 73 65 64 20 | player.|..Based |
|00001b00| 6f 6e 20 74 68 65 20 63 | 6f 6d 6d 61 6e 64 2c 20 |on the c|ommand, |
|00001b10| 74 68 65 20 73 79 73 74 | 65 6d 20 77 69 6c 6c 20 |the syst|em will |
|00001b20| 6d 61 6e 69 70 75 6c 61 | 74 65 20 74 68 65 20 6f |manipula|te the o|
|00001b30| 62 6a 65 63 74 73 20 79 | 6f 75 20 64 65 66 69 6e |bjects y|ou defin|
|00001b40| 65 64 0d 0a 61 63 63 6f | 72 64 69 6e 67 20 74 6f |ed..acco|rding to|
|00001b50| 20 68 6f 77 20 79 6f 75 | 20 64 65 63 6c 61 72 65 | how you| declare|
|00001b60| 20 74 68 65 73 65 20 6f | 62 6a 65 63 74 73 20 74 | these o|bjects t|
|00001b70| 6f 20 62 65 68 61 76 65 | 2e 20 20 59 6f 75 20 64 |o behave|. You d|
|00001b80| 6f 6e 27 74 20 68 61 76 | 65 20 74 6f 0d 0a 77 6f |on't hav|e to..wo|
|00001b90| 72 72 79 20 61 62 6f 75 | 74 20 77 68 61 74 20 74 |rry abou|t what t|
|00001ba0| 68 65 20 70 6c 61 79 65 | 72 20 74 79 70 65 73 3b |he playe|r types;|
|00001bb0| 20 79 6f 75 20 6a 75 73 | 74 20 68 61 76 65 20 74 | you jus|t have t|
|00001bc0| 6f 20 73 70 65 63 69 66 | 79 20 68 6f 77 20 79 6f |o specif|y how yo|
|00001bd0| 75 72 20 6f 62 6a 65 63 | 74 73 0d 0a 62 65 68 61 |ur objec|ts..beha|
|00001be0| 76 65 20 61 6e 64 20 68 | 6f 77 20 74 68 65 79 20 |ve and h|ow they |
|00001bf0| 69 6e 74 65 72 61 63 74 | 20 77 69 74 68 20 6f 6e |interact| with on|
|00001c00| 65 20 61 6e 6f 74 68 65 | 72 2e 0d 0a 0d 0a 5c 6d |e anothe|r.....\m|
|00001c10| 61 6a 6f 72 73 65 63 74 | 69 6f 6e 7b 41 64 64 69 |ajorsect|ion{Addi|
|00001c20| 6e 67 20 49 74 65 6d 73 | 20 74 6f 20 74 68 65 20 |ng Items| to the |
|00001c30| 47 61 6d 65 7d 0d 0a 0d | 0a 4e 6f 77 20 6c 65 74 |Game}...|.Now let|
|00001c40| 27 73 20 61 64 64 20 61 | 20 66 65 77 20 69 74 65 |'s add a| few ite|
|00001c50| 6d 73 20 74 6f 20 74 68 | 65 20 67 61 6d 65 20 74 |ms to th|e game t|
|00001c60| 68 61 74 20 63 61 6e 20 | 62 65 20 6d 61 6e 69 70 |hat can |be manip|
|00001c70| 75 6c 61 74 65 64 20 62 | 79 20 74 68 65 0d 0a 70 |ulated b|y the..p|
|00001c80| 6c 61 79 65 72 2c 20 73 | 6f 20 68 65 20 63 61 6e |layer, s|o he can|
|00001c90| 20 64 6f 20 73 6f 6d 65 | 74 68 69 6e 67 0d 0a 62 | do some|thing..b|
|00001ca0| 65 73 69 64 65 73 20 77 | 61 6c 6b 20 62 61 63 6b |esides w|alk back|
|00001cb0| 20 61 6e 64 20 66 6f 72 | 74 68 20 62 65 74 77 65 | and for|th betwe|
|00001cc0| 65 6e 20 6f 75 72 20 74 | 77 6f 20 72 6f 6f 6d 73 |en our t|wo rooms|
|00001cd0| 2e 0d 0a 57 65 27 6c 6c | 20 61 64 64 20 61 20 73 |...We'll| add a s|
|00001ce0| 6f 6c 69 64 20 67 6f 6c | 64 20 73 6b 75 6c 6c 2c |olid gol|d skull,|
|00001cf0| 20 61 6e 64 20 61 20 70 | 65 64 65 73 74 61 6c 20 | and a p|edestal |
|00001d00| 66 6f 72 20 69 74 20 74 | 6f 20 73 69 74 20 75 70 |for it t|o sit up|
|00001d10| 6f 6e 2e 0d 0a 0d 0a 7b | 5c 65 78 61 6d 70 6c 65 |on.....{|\example|
|00001d20| 0d 0a 20 20 20 20 5c 6f | 62 6a 65 63 74 7b 70 65 |.. \o|bject{pe|
|00001d30| 64 65 73 74 61 6c 3a 20 | 73 75 72 66 61 63 65 2c |destal: |surface,|
|00001d40| 20 66 69 78 65 64 69 74 | 65 6d 7d 0d 0a 20 20 20 | fixedit|em}.. |
|00001d50| 20 20 20 73 64 65 73 63 | 20 3d 20 22 70 65 64 65 | sdesc| = "pede|
|00001d60| 73 74 61 6c 22 0d 0a 20 | 20 20 20 20 20 6e 6f 75 |stal".. | nou|
|00001d70| 6e 20 3d 20 27 70 65 64 | 65 73 74 61 6c 27 0d 0a |n = 'ped|estal'..|
|00001d80| 20 20 20 20 20 20 6c 6f | 63 61 74 69 6f 6e 20 3d | lo|cation =|
|00001d90| 20 63 61 76 65 0d 0a 20 | 20 20 20 5c 65 6e 64 6f | cave.. | \endo|
|00001da0| 62 6a 0d 0a 20 20 20 20 | 0d 0a 20 20 20 20 5c 6f |bj.. |.. \o|
|00001db0| 62 6a 65 63 74 7b 67 6f | 6c 64 53 6b 75 6c 6c 3a |bject{go|ldSkull:|
|00001dc0| 20 69 74 65 6d 7d 0d 0a | 20 20 20 20 20 20 73 64 | item}..| sd|
|00001dd0| 65 73 63 20 3d 20 22 67 | 6f 6c 64 20 73 6b 75 6c |esc = "g|old skul|
|00001de0| 6c 22 0d 0a 20 20 20 20 | 20 20 6e 6f 75 6e 20 3d |l".. | noun =|
|00001df0| 20 27 73 6b 75 6c 6c 27 | 20 27 68 65 61 64 27 0d | 'skull'| 'head'.|
|00001e00| 0a 20 20 20 20 20 20 61 | 64 6a 65 63 74 69 76 65 |. a|djective|
|00001e10| 20 3d 20 27 67 6f 6c 64 | 27 0d 0a 20 20 20 20 20 | = 'gold|'.. |
|00001e20| 20 6c 6f 63 61 74 69 6f | 6e 20 3d 20 70 65 64 65 | locatio|n = pede|
|00001e30| 73 74 61 6c 0d 0a 20 20 | 20 20 5c 65 6e 64 6f 62 |stal.. | \endob|
|00001e40| 6a 0d 0a 7d 0d 0a 0d 0a | 48 65 72 65 20 77 65 27 |j..}....|Here we'|
|00001e50| 76 65 20 64 65 66 69 6e | 65 64 20 74 77 6f 20 6f |ve defin|ed two o|
|00001e60| 62 6a 65 63 74 73 2c 20 | 7b 5c 74 74 20 70 65 64 |bjects, |{\tt ped|
|00001e70| 65 73 74 61 6c 7d 20 61 | 6e 64 20 7b 5c 74 74 20 |estal} a|nd {\tt |
|00001e80| 67 6f 6c 64 53 6b 75 6c | 6c 7d 2e 0d 0a 0d 0a 54 |goldSkul|l}.....T|
|00001e90| 68 65 20 7b 5c 74 74 20 | 70 65 64 65 73 74 61 6c |he {\tt |pedestal|
|00001ea0| 7d 20 62 65 6c 6f 6e 67 | 73 20 74 6f 20 74 77 6f |} belong|s to two|
|00001eb0| 20 5e 7b 63 6c 61 73 73 | 65 73 7d 2c 0d 0a 7b 5c | ^{class|es},..{\|
|00001ec0| 74 74 20 73 75 72 66 61 | 63 65 7d 20 61 6e 64 20 |tt surfa|ce} and |
|00001ed0| 7b 5c 74 74 20 66 69 78 | 65 64 69 74 65 6d 7d 2e |{\tt fix|editem}.|
|00001ee0| 0d 0a 54 68 69 73 20 6d | 65 61 6e 73 20 74 68 61 |..This m|eans tha|
|00001ef0| 74 20 69 74 20 68 61 73 | 20 61 74 74 72 69 62 75 |t it has| attribu|
|00001f00| 74 65 73 20 6f 66 20 62 | 6f 74 68 20 63 6c 61 73 |tes of b|oth clas|
|00001f10| 73 65 73 3b 20 77 68 65 | 6e 20 74 68 65 72 65 27 |ses; whe|n there'|
|00001f20| 73 20 61 20 63 6f 6e 66 | 6c 69 63 74 2c 0d 0a 74 |s a conf|lict,..t|
|00001f30| 68 65 20 7b 5c 74 74 20 | 73 75 72 66 61 63 65 7d |he {\tt |surface}|
|00001f40| 20 63 6c 61 73 73 20 74 | 61 6b 65 73 20 70 72 65 | class t|akes pre|
|00001f50| 63 65 64 65 6e 63 65 2c | 20 62 65 63 61 75 73 65 |cedence,| because|
|00001f60| 20 69 74 27 73 20 66 69 | 72 73 74 20 69 6e 20 74 | it's fi|rst in t|
|00001f70| 68 65 20 6c 69 73 74 20 | 6f 66 0d 0a 63 6c 61 73 |he list |of..clas|
|00001f80| 73 65 73 2e 20 4f 62 6a | 65 63 74 73 20 6f 66 20 |ses. Obj|ects of |
|00001f90| 74 68 65 20 7b 5c 74 74 | 20 73 75 72 66 61 63 65 |the {\tt| surface|
|00001fa0| 7d 20 63 6c 61 73 73 20 | 63 61 6e 20 68 61 76 65 |} class |can have|
|00001fb0| 20 6f 74 68 65 72 20 6f | 62 6a 65 63 74 73 20 70 | other o|bjects p|
|00001fc0| 6c 61 63 65 64 0d 0a 6f | 6e 20 74 6f 70 20 6f 66 |laced..o|n top of|
|00001fd0| 20 74 68 65 6d 3b 20 6f | 62 6a 65 63 74 73 20 6f | them; o|bjects o|
|00001fe0| 66 20 74 68 65 20 7b 5c | 74 74 20 66 69 78 65 64 |f the {\|tt fixed|
|00001ff0| 69 74 65 6d 7d 20 63 6c | 61 73 73 20 63 61 6e 27 |item} cl|ass can'|
|00002000| 74 20 62 65 20 63 61 72 | 72 69 65 64 2e 0d 0a 4e |t be car|ried...N|
|00002010| 6f 74 65 20 74 68 61 74 | 20 74 68 65 20 7b 5c 74 |ote that| the {\t|
|00002020| 74 20 73 75 72 66 61 63 | 65 7d 20 63 6c 61 73 73 |t surfac|e} class|
|00002030| 20 68 61 73 20 61 20 64 | 65 66 61 75 6c 74 20 7b | has a d|efault {|
|00002040| 5c 74 74 20 6c 64 65 73 | 63 7d 20 70 72 6f 70 65 |\tt ldes|c} prope|
|00002050| 72 74 79 20 77 68 69 63 | 68 0d 0a 6c 69 73 74 73 |rty whic|h..lists|
|00002060| 20 61 6e 79 20 6f 62 6a | 65 63 74 73 20 6f 6e 20 | any obj|ects on |
|00002070| 74 68 65 20 73 75 72 66 | 61 63 65 2e 0d 0a 0d 0a |the surf|ace.....|
|00002080| 54 68 65 20 7b 5c 74 74 | 20 67 6f 6c 64 53 6b 75 |The {\tt| goldSku|
|00002090| 6c 6c 7d 20 62 65 6c 6f | 6e 67 73 20 74 6f 20 74 |ll} belo|ngs to t|
|000020a0| 68 65 20 7b 5c 74 74 20 | 69 74 65 6d 7d 20 63 6c |he {\tt |item} cl|
|000020b0| 61 73 73 2c 20 77 68 69 | 63 68 20 69 73 20 74 68 |ass, whi|ch is th|
|000020c0| 65 0d 0a 67 65 6e 65 72 | 69 63 20 63 6c 61 73 73 |e..gener|ic class|
|000020d0| 20 66 6f 72 20 6f 62 6a | 65 63 74 73 20 77 69 74 | for obj|ects wit|
|000020e0| 68 6f 75 74 20 61 6e 79 | 20 73 70 65 63 69 61 6c |hout any| special|
|000020f0| 20 70 72 6f 70 65 72 74 | 69 65 73 2e 0d 0a 0d 0a | propert|ies.....|
|00002100| 53 69 6e 63 65 20 74 68 | 65 73 65 20 6f 62 6a 65 |Since th|ese obje|
|00002110| 63 74 73 20 63 61 6e 20 | 62 65 20 6d 61 6e 69 70 |cts can |be manip|
|00002120| 75 6c 61 74 65 64 20 64 | 69 72 65 63 74 6c 79 20 |ulated d|irectly |
|00002130| 62 79 20 74 68 65 20 70 | 6c 61 79 65 72 2c 20 74 |by the p|layer, t|
|00002140| 68 65 20 70 6c 61 79 65 | 72 0d 0a 6e 65 65 64 73 |he playe|r..needs|
|00002150| 20 77 6f 72 64 73 20 74 | 6f 20 72 65 66 65 72 20 | words t|o refer |
|00002160| 74 6f 20 74 68 65 6d 2e | 20 54 68 69 73 20 69 73 |to them.| This is|
|00002170| 20 77 68 61 74 20 74 68 | 65 20 7b 5c 74 74 20 5e | what th|e {\tt ^|
|00002180| 7b 6e 6f 75 6e 7d 7d 0d | 0a 61 6e 64 20 7b 5c 74 |{noun}}.|.and {\t|
|00002190| 74 20 5e 7b 61 64 6a 65 | 63 74 69 76 65 7d 7d 0d |t ^{adje|ctive}}.|
|000021a0| 0a 70 72 6f 70 65 72 74 | 69 65 73 20 64 65 66 69 |.propert|ies defi|
|000021b0| 6e 65 2e 20 41 6c 6c 20 | 6f 62 6a 65 63 74 73 20 |ne. All |objects |
|000021c0| 74 68 61 74 20 74 68 65 | 20 70 6c 61 79 65 72 20 |that the| player |
|000021d0| 63 61 6e 20 6d 61 6e 69 | 70 75 6c 61 74 65 20 6d |can mani|pulate m|
|000021e0| 75 73 74 20 68 61 76 65 | 20 61 74 0d 0a 6c 65 61 |ust have| at..lea|
|000021f0| 73 74 20 6f 6e 65 20 7b | 5c 74 74 20 6e 6f 75 6e |st one {|\tt noun|
|00002200| 7d 2e 20 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |}. Note |that the|
|00002210| 20 7b 5c 74 74 20 67 6f | 6c 64 53 6b 75 6c 6c 7d | {\tt go|ldSkull}|
|00002220| 20 68 61 73 20 74 77 6f | 20 6e 6f 75 6e 73 3b 20 | has two| nouns; |
|00002230| 74 68 65 79 20 61 72 65 | 0d 0a 73 69 6d 70 6c 79 |they are|..simply|
|00002240| 20 6c 69 73 74 65 64 20 | 77 69 74 68 20 61 20 73 | listed |with a s|
|00002250| 70 61 63 65 20 62 65 74 | 77 65 65 6e 20 74 68 65 |pace bet|ween the|
|00002260| 6d 2e 20 4f 62 6a 65 63 | 74 73 20 63 61 6e 20 61 |m. Objec|ts can a|
|00002270| 6c 73 6f 20 68 61 76 65 | 0d 0a 61 64 6a 65 63 74 |lso have|..adject|
|00002280| 69 76 65 73 3b 20 74 68 | 65 73 65 20 73 65 72 76 |ives; th|ese serv|
|00002290| 65 20 74 6f 20 64 69 73 | 74 69 6e 67 75 69 73 68 |e to dis|tinguish|
|000022a0| 20 62 65 74 77 65 65 6e | 20 6f 62 6a 65 63 74 73 | between| objects|
|000022b0| 20 77 68 69 63 68 20 68 | 61 76 65 0d 0a 74 68 65 | which h|ave..the|
|000022c0| 20 73 61 6d 65 20 6e 6f | 75 6e 2c 20 62 75 74 20 | same no|un, but |
|000022d0| 61 72 65 20 6f 74 68 65 | 72 77 69 73 65 20 6f 70 |are othe|rwise op|
|000022e0| 74 69 6f 6e 61 6c 2e 20 | 41 20 67 6f 6f 64 20 67 |tional. |A good g|
|000022f0| 61 6d 65 20 77 69 6c 6c | 20 72 65 63 6f 67 6e 69 |ame will| recogni|
|00002300| 7a 65 20 61 6c 6c 20 6f | 66 0d 0a 74 68 65 20 77 |ze all o|f..the w|
|00002310| 6f 72 64 73 20 69 74 20 | 75 73 65 73 20 74 6f 20 |ords it |uses to |
|00002320| 64 65 73 63 72 69 62 65 | 20 61 6e 20 6f 62 6a 65 |describe| an obje|
|00002330| 63 74 2c 20 73 6f 20 69 | 66 20 79 6f 75 20 64 65 |ct, so i|f you de|
|00002340| 73 63 72 69 62 65 20 74 | 68 65 20 73 6b 75 6c 6c |scribe t|he skull|
|00002350| 20 61 73 0d 0a 61 20 60 | 60 67 6f 6c 64 20 73 6b | as..a `|`gold sk|
|00002360| 75 6c 6c 2c 27 27 20 79 | 6f 75 20 73 68 6f 75 6c |ull,'' y|ou shoul|
|00002370| 64 20 75 6e 64 65 72 73 | 74 61 6e 64 20 69 74 20 |d unders|tand it |
|00002380| 77 68 65 6e 20 74 68 65 | 20 70 6c 61 79 65 72 20 |when the| player |
|00002390| 73 61 79 73 20 60 60 74 | 61 6b 65 20 74 68 65 0d |says ``t|ake the.|
|000023a0| 0a 67 6f 6c 64 20 73 6b | 75 6c 6c 2e 27 27 0d 0a |.gold sk|ull.''..|
|000023b0| 0d 0a 54 68 69 73 20 62 | 72 69 6e 67 73 20 75 73 |..This b|rings us|
|000023c0| 20 74 6f 20 61 20 73 75 | 62 74 6c 65 74 79 2e 20 | to a su|btlety. |
|000023d0| 4e 6f 74 69 63 65 20 74 | 68 61 74 20 74 68 65 20 |Notice t|hat the |
|000023e0| 7b 5c 74 74 20 6c 64 65 | 73 63 7d 20 61 6e 64 20 |{\tt lde|sc} and |
|000023f0| 6f 74 68 65 72 20 70 72 | 6f 70 65 72 74 69 65 73 |other pr|operties|
|00002400| 0d 0a 75 73 65 20 7b 5c | 69 74 20 64 6f 75 62 6c |..use {\|it doubl|
|00002410| 65 7d 20 71 75 6f 74 65 | 73 20 61 72 6f 75 6e 64 |e} quote|s around|
|00002420| 20 74 68 65 69 72 20 73 | 74 72 69 6e 67 73 2c 20 | their s|trings, |
|00002430| 62 75 74 20 74 68 65 20 | 7b 5c 74 74 20 6e 6f 75 |but the |{\tt nou|
|00002440| 6e 7d 20 61 6e 64 0d 0a | 7b 5c 74 74 20 61 64 6a |n} and..|{\tt adj|
|00002450| 65 63 74 69 76 65 7d 20 | 70 72 6f 70 65 72 74 69 |ective} |properti|
|00002460| 65 73 20 68 61 76 65 20 | 7b 5c 69 74 20 73 69 6e |es have |{\it sin|
|00002470| 67 6c 65 7d 20 71 75 6f | 74 65 73 2e 20 5e 7b 56 |gle} quo|tes. ^{V|
|00002480| 6f 63 61 62 75 6c 61 72 | 79 7d 0d 0a 77 6f 72 64 |ocabular|y}..word|
|00002490| 73 20 28 6e 6f 75 6e 73 | 2c 0d 0a 61 64 6a 65 63 |s (nouns|,..adjec|
|000024a0| 74 69 76 65 73 2c 20 5e | 7b 76 65 72 62 73 7d 2c |tives, ^|{verbs},|
|000024b0| 20 5e 7b 70 72 65 70 6f | 73 69 74 69 6f 6e 73 7d | ^{prepo|sitions}|
|000024c0| 2c 20 61 6e 64 20 5e 7b | 61 72 74 69 63 6c 65 73 |, and ^{|articles|
|000024d0| 7d 29 20 7b 5c 69 74 20 | 61 6c 77 61 79 73 7d 20 |}) {\it |always} |
|000024e0| 75 73 65 0d 0a 5e 7b 73 | 69 6e 67 6c 65 20 71 75 |use..^{s|ingle qu|
|000024f0| 6f 74 65 73 7d 2e 0d 0a | 41 6c 6d 6f 73 74 20 65 |otes}...|Almost e|
|00002500| 76 65 72 79 74 68 69 6e | 67 20 65 6c 73 65 20 77 |verythin|g else w|
|00002510| 69 6c 6c 20 75 73 65 20 | 5e 7b 64 6f 75 62 6c 65 |ill use |^{double|
|00002520| 20 71 75 6f 74 65 73 7d | 2e 20 54 68 65 20 64 69 | quotes}|. The di|
|00002530| 73 74 69 6e 63 74 69 6f | 6e 20 69 73 0d 0a 74 68 |stinctio|n is..th|
|00002540| 61 74 20 61 20 73 74 72 | 69 6e 67 20 65 6e 63 6c |at a str|ing encl|
|00002550| 6f 73 65 64 20 69 6e 20 | 64 6f 75 62 6c 65 20 71 |osed in |double q|
|00002560| 75 6f 74 65 73 20 69 73 | 20 64 69 73 70 6c 61 79 |uotes is| display|
|00002570| 65 64 20 69 6d 6d 65 64 | 69 61 74 65 6c 79 20 65 |ed immed|iately e|
|00002580| 76 65 72 79 20 74 69 6d | 65 20 69 74 0d 0a 69 73 |very tim|e it..is|
|00002590| 20 65 76 61 6c 75 61 74 | 65 64 2c 20 77 68 69 6c | evaluat|ed, whil|
|000025a0| 65 20 61 20 73 74 72 69 | 6e 67 20 65 6e 63 6c 6f |e a stri|ng enclo|
|000025b0| 73 65 64 20 69 6e 20 73 | 69 6e 67 6c 65 20 71 75 |sed in s|ingle qu|
|000025c0| 6f 74 65 73 20 69 73 20 | 61 20 73 74 72 69 6e 67 |otes is |a string|
|000025d0| 20 76 61 6c 75 65 20 74 | 68 61 74 0d 0a 63 61 6e | value t|hat..can|
|000025e0| 20 62 65 20 6d 61 6e 69 | 70 75 6c 61 74 65 64 20 | be mani|pulated |
|000025f0| 69 6e 74 65 72 6e 61 6c | 6c 79 2e 20 44 6f 75 62 |internal|ly. Doub|
|00002600| 6c 65 2d 71 75 6f 74 65 | 64 20 73 74 72 69 6e 67 |le-quote|d string|
|00002610| 73 20 61 72 65 20 64 69 | 73 70 6c 61 79 65 64 0d |s are di|splayed.|
|00002620| 0a 61 75 74 6f 6d 61 74 | 69 63 61 6c 6c 79 20 61 |.automat|ically a|
|00002630| 73 20 61 20 63 6f 6e 76 | 65 6e 69 65 6e 63 65 2c |s a conv|enience,|
|00002640| 20 73 69 6e 63 65 20 6d | 6f 73 74 20 73 74 72 69 | since m|ost stri|
|00002650| 6e 67 73 20 69 6e 20 74 | 65 78 74 20 61 64 76 65 |ngs in t|ext adve|
|00002660| 6e 74 75 72 65 73 0d 0a | 61 72 65 20 64 69 73 70 |ntures..|are disp|
|00002670| 6c 61 79 65 64 20 77 69 | 74 68 6f 75 74 20 66 75 |layed wi|thout fu|
|00002680| 72 74 68 65 72 20 70 72 | 6f 63 65 73 73 69 6e 67 |rther pr|ocessing|
|00002690| 2e 20 28 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |. (Note |that the|
|000026a0| 20 64 6f 75 62 6c 65 20 | 71 75 6f 74 65 20 6d 61 | double |quote ma|
|000026b0| 72 6b 0d 0a 69 73 20 61 | 20 73 65 70 61 72 61 74 |rk..is a| separat|
|000026c0| 65 20 63 68 61 72 61 63 | 74 65 72 20 6f 6e 20 74 |e charac|ter on t|
|000026d0| 68 65 20 6b 65 79 62 6f | 61 72 64 2c 20 61 6e 64 |he keybo|ard, and|
|000026e0| 20 69 73 20 6e 6f 74 20 | 73 69 6d 70 6c 79 20 74 | is not |simply t|
|000026f0| 77 6f 20 73 69 6e 67 6c | 65 20 71 75 6f 74 65 0d |wo singl|e quote.|
|00002700| 0a 6d 61 72 6b 73 2e 29 | 0d 0a 0d 0a 54 68 65 73 |.marks.)|....Thes|
|00002710| 65 20 74 77 6f 20 6f 62 | 6a 65 63 74 73 20 68 61 |e two ob|jects ha|
|00002720| 76 65 20 61 6e 6f 74 68 | 65 72 20 6e 65 77 20 70 |ve anoth|er new p|
|00002730| 72 6f 70 65 72 74 79 2c | 20 7b 5c 74 74 20 5e 7b |roperty,| {\tt ^{|
|00002740| 6c 6f 63 61 74 69 6f 6e | 7d 7d 2e 20 54 68 69 73 |location|}}. This|
|00002750| 20 73 69 6d 70 6c 79 0d | 0a 64 65 66 69 6e 65 73 | simply.|.defines|
|00002760| 20 74 68 65 20 6f 62 6a | 65 63 74 20 74 68 61 74 | the obj|ect that|
|00002770| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 6f 62 | contain|s the ob|
|00002780| 6a 65 63 74 20 62 65 69 | 6e 67 20 64 65 66 69 6e |ject bei|ng defin|
|00002790| 65 64 2e 20 49 6e 20 74 | 68 65 20 63 61 73 65 20 |ed. In t|he case |
|000027a0| 6f 66 0d 0a 74 68 65 20 | 7b 5c 74 74 20 70 65 64 |of..the |{\tt ped|
|000027b0| 65 73 74 61 6c 7d 2c 20 | 74 68 65 20 63 6f 6e 74 |estal}, |the cont|
|000027c0| 61 69 6e 69 6e 67 20 6f | 62 6a 65 63 74 20 69 73 |aining o|bject is|
|000027d0| 20 74 68 65 20 7b 5c 74 | 74 20 63 61 76 65 7d 20 | the {\t|t cave} |
|000027e0| 72 6f 6f 6d 3b 20 73 69 | 6e 63 65 0d 0a 74 68 65 |room; si|nce..the|
|000027f0| 20 7b 5c 74 74 20 67 6f | 6c 64 53 6b 75 6c 6c 7d | {\tt go|ldSkull}|
|00002800| 20 69 73 20 6f 6e 20 74 | 68 65 20 7b 5c 74 74 20 | is on t|he {\tt |
|00002810| 70 65 64 65 73 74 61 6c | 7d 2c 20 69 74 73 20 6c |pedestal|}, its l|
|00002820| 6f 63 61 74 69 6f 6e 20 | 69 73 20 7b 5c 74 74 20 |ocation |is {\tt |
|00002830| 70 65 64 65 73 74 61 6c | 7d 2e 0d 0a 28 4e 6f 74 |pedestal|}...(Not|
|00002840| 65 20 74 68 61 74 20 74 | 68 65 20 73 79 73 74 65 |e that t|he syste|
|00002850| 6d 20 6d 61 6b 65 73 20 | 6e 6f 20 64 69 73 74 69 |m makes |no disti|
|00002860| 6e 63 74 69 6f 6e 2c 20 | 61 74 20 74 68 69 73 20 |nction, |at this |
|00002870| 6c 65 76 65 6c 2c 20 62 | 65 74 77 65 65 6e 20 61 |level, b|etween a|
|00002880| 6e 20 6f 62 6a 65 63 74 | 0d 0a 62 65 69 6e 67 20 |n object|..being |
|00002890| 7b 5c 69 74 20 69 6e 73 | 69 64 65 7d 20 61 6e 6f |{\it ins|ide} ano|
|000028a0| 74 68 65 72 20 6f 62 6a | 65 63 74 20 61 6e 64 20 |ther obj|ect and |
|000028b0| 74 68 65 20 6f 62 6a 65 | 63 74 20 62 65 69 6e 67 |the obje|ct being|
|000028c0| 20 7b 5c 69 74 20 6f 6e | 7d 20 61 6e 6f 74 68 65 | {\it on|} anothe|
|000028d0| 72 0d 0a 6f 62 6a 65 63 | 74 2e 20 54 68 69 73 20 |r..objec|t. This |
|000028e0| 6d 65 61 6e 73 20 74 68 | 61 74 20 61 6e 20 6f 62 |means th|at an ob|
|000028f0| 6a 65 63 74 20 63 61 6e | 27 74 20 62 65 20 62 6f |ject can|'t be bo|
|00002900| 74 68 20 61 20 7b 5c 74 | 74 20 73 75 72 66 61 63 |th a {\t|t surfac|
|00002910| 65 7d 20 61 6e 64 20 61 | 0d 0a 7b 5c 74 74 20 63 |e} and a|..{\tt c|
|00002920| 6f 6e 74 61 69 6e 65 72 | 7d 2e 29 0d 0a 0d 0a 5c |ontainer|}.)....\|
|00002930| 6d 61 6a 6f 72 73 65 63 | 74 69 6f 6e 7b 4d 61 6b |majorsec|tion{Mak|
|00002940| 69 6e 67 20 74 68 65 20 | 49 74 65 6d 73 20 44 6f |ing the |Items Do|
|00002950| 20 53 6f 6d 65 74 68 69 | 6e 67 7d 0d 0a 0d 0a 54 | Somethi|ng}....T|
|00002960| 68 65 20 67 61 6d 65 20 | 69 73 20 73 74 69 6c 6c |he game |is still|
|00002970| 20 72 61 74 68 65 72 20 | 62 6c 61 6e 64 3b 20 69 | rather |bland; i|
|00002980| 74 20 68 61 73 20 6e 6f | 20 70 75 7a 7a 6c 65 73 |t has no| puzzles|
|00002990| 2e 20 53 6f 2c 20 6c 65 | 74 27 73 20 69 6e 74 72 |. So, le|t's intr|
|000029a0| 6f 64 75 63 65 20 61 0d | 0a 73 6d 61 6c 6c 20 70 |oduce a.|.small p|
|000029b0| 75 7a 7a 6c 65 2e 20 4c | 65 74 27 73 20 61 73 73 |uzzle. L|et's ass|
|000029c0| 75 6d 65 20 74 68 61 74 | 20 74 68 65 20 67 6f 6c |ume that| the gol|
|000029d0| 64 20 73 6b 75 6c 6c 20 | 77 61 73 6e 27 74 20 6d |d skull |wasn't m|
|000029e0| 65 72 65 6c 79 20 6c 65 | 66 74 20 6c 61 79 69 6e |erely le|ft layin|
|000029f0| 67 0d 0a 61 72 6f 75 6e | 64 3b 20 69 6e 73 74 65 |g..aroun|d; inste|
|00002a00| 61 64 2c 20 77 68 6f 65 | 76 65 72 20 6c 65 66 74 |ad, whoe|ver left|
|00002a10| 20 69 74 20 74 68 65 72 | 65 20 61 72 72 61 6e 67 | it ther|e arrang|
|00002a20| 65 64 20 66 6f 72 20 61 | 20 74 72 61 70 20 74 6f |ed for a| trap to|
|00002a30| 20 67 6f 20 6f 66 66 20 | 69 66 0d 0a 69 74 20 73 | go off |if..it s|
|00002a40| 68 6f 75 6c 64 20 62 65 | 20 6c 69 66 74 65 64 20 |hould be| lifted |
|00002a50| 6f 66 66 20 74 68 65 20 | 70 65 64 65 73 74 61 6c |off the |pedestal|
|00002a60| 2e 20 20 54 6f 20 69 6d | 70 6c 65 6d 65 6e 74 20 |. To im|plement |
|00002a70| 74 68 69 73 2c 20 77 65 | 20 6e 65 65 64 20 74 6f |this, we| need to|
|00002a80| 20 61 64 64 0d 0a 61 20 | 7b 5c 73 6c 20 6d 65 74 | add..a |{\sl met|
|00002a90| 68 6f 64 7d 20 74 6f 20 | 74 68 65 20 7b 5c 74 74 |hod} to |the {\tt|
|00002aa0| 20 67 6f 6c 64 53 6b 75 | 6c 6c 7d 20 6f 62 6a 65 | goldSku|ll} obje|
|00002ab0| 63 74 2e 20 20 41 20 7b | 5c 73 6c 20 5e 7b 6d 65 |ct. A {|\sl ^{me|
|00002ac0| 74 68 6f 64 7d 7d 20 69 | 73 20 61 20 73 70 65 63 |thod}} i|s a spec|
|00002ad0| 69 61 6c 0d 0a 74 79 70 | 65 20 6f 66 20 70 72 6f |ial..typ|e of pro|
|00002ae0| 70 65 72 74 79 20 77 68 | 69 63 68 20 63 6f 6e 74 |perty wh|ich cont|
|00002af0| 61 69 6e 73 20 63 6f 64 | 65 20 74 6f 20 62 65 20 |ains cod|e to be |
|00002b00| 65 78 65 63 75 74 65 64 | 3b 20 69 74 20 69 73 20 |executed|; it is |
|00002b10| 76 65 72 79 20 6d 75 63 | 68 20 6c 69 6b 65 0d 0a |very muc|h like..|
|00002b20| 61 20 66 75 6e 63 74 69 | 6f 6e 20 69 6e 20 5e 7b |a functi|on in ^{|
|00002b30| 43 7d 20 6f 72 20 5e 7b | 50 61 73 63 61 6c 7d 2e |C} or ^{|Pascal}.|
|00002b40| 20 54 68 65 20 6e 65 77 | 20 7b 5c 74 74 20 67 6f | The new| {\tt go|
|00002b50| 6c 64 53 6b 75 6c 6c 7d | 20 77 69 74 68 20 74 68 |ldSkull}| with th|
|00002b60| 65 20 6d 65 74 68 6f 64 | 20 6c 6f 6f 6b 73 0d 0a |e method| looks..|
|00002b70| 6c 69 6b 65 20 74 68 69 | 73 3a 0d 0a 0d 0a 7b 5c |like thi|s:....{\|
|00002b80| 65 78 61 6d 70 6c 65 0d | 0a 20 20 20 20 5c 6f 62 |example.|. \ob|
|00002b90| 6a 65 63 74 7b 67 6f 6c | 64 53 6b 75 6c 6c 3a 20 |ject{gol|dSkull: |
|00002ba0| 69 74 65 6d 7d 0d 0a 20 | 20 20 20 20 20 73 64 65 |item}.. | sde|
|00002bb0| 73 63 20 3d 20 22 67 6f | 6c 64 20 73 6b 75 6c 6c |sc = "go|ld skull|
|00002bc0| 22 0d 0a 20 20 20 20 20 | 20 6e 6f 75 6e 20 3d 20 |".. | noun = |
|00002bd0| 27 73 6b 75 6c 6c 27 20 | 27 68 65 61 64 27 0d 0a |'skull' |'head'..|
|00002be0| 20 20 20 20 20 20 61 64 | 6a 65 63 74 69 76 65 20 | ad|jective |
|00002bf0| 3d 20 27 67 6f 6c 64 27 | 0d 0a 20 20 20 20 20 20 |= 'gold'|.. |
|00002c00| 6c 6f 63 61 74 69 6f 6e | 20 3d 20 70 65 64 65 73 |location| = pedes|
|00002c10| 74 61 6c 0d 0a 20 20 20 | 20 20 20 64 6f 54 61 6b |tal.. | doTak|
|00002c20| 65 28 20 61 63 74 6f 72 | 20 29 20 3d 0d 0a 20 20 |e( actor| ) =.. |
|00002c30| 20 20 20 20 5c 6c 62 0d | 0a 20 20 20 20 20 20 20 | \lb.|. |
|00002c40| 20 22 41 73 20 79 6f 75 | 20 6c 69 66 74 20 74 68 | "As you| lift th|
|00002c50| 65 20 73 6b 75 6c 6c 2c | 20 61 20 76 6f 6c 6c 65 |e skull,| a volle|
|00002c60| 79 20 6f 66 20 70 6f 69 | 73 6f 6e 6f 75 73 0d 0a |y of poi|sonous..|
|00002c70| 09 61 72 72 6f 77 73 20 | 69 73 20 73 68 6f 74 20 |.arrows |is shot |
|00002c80| 66 72 6f 6d 20 74 68 65 | 20 77 61 6c 6c 73 21 20 |from the| walls! |
|00002c90| 59 6f 75 20 74 72 79 20 | 74 6f 20 64 6f 64 67 65 |You try |to dodge|
|00002ca0| 0d 0a 09 74 68 65 20 61 | 72 72 6f 77 73 2c 20 62 |...the a|rrows, b|
|00002cb0| 75 74 20 74 68 65 79 20 | 74 61 6b 65 20 79 6f 75 |ut they |take you|
|00002cc0| 20 62 79 20 73 75 72 70 | 72 69 73 65 21 22 3b 0d | by surp|rise!";.|
|00002cd0| 0a 09 64 69 65 28 29 3b | 0d 0a 20 20 20 20 20 20 |..die();|.. |
|00002ce0| 5c 72 62 0d 0a 20 20 20 | 20 5c 65 6e 64 6f 62 6a |\rb.. | \endobj|
|00002cf0| 0d 0a 7d 0d 0a 0d 0a 54 | 68 65 20 6d 65 74 68 6f |..}....T|he metho|
|00002d00| 64 20 7b 5c 74 74 20 64 | 6f 54 61 6b 65 7d 20 28 |d {\tt d|oTake} (|
|00002d10| 77 68 69 63 68 20 73 74 | 61 6e 64 73 20 66 6f 72 |which st|ands for|
|00002d20| 20 60 60 7b 5c 62 66 20 | 64 7d 69 72 65 63 74 20 | ``{\bf |d}irect |
|00002d30| 7b 5c 62 66 20 6f 7d 62 | 6a 65 63 74 0d 0a 7b 5c |{\bf o}b|ject..{\|
|00002d40| 62 66 20 74 61 6b 65 7d | 27 27 29 20 74 61 6b 65 |bf take}|'') take|
|00002d50| 73 20 61 73 20 61 6e 20 | 61 72 67 75 6d 65 6e 74 |s as an |argument|
|00002d60| 20 74 68 65 20 63 68 61 | 72 61 63 74 65 72 20 77 | the cha|racter w|
|00002d70| 68 6f 20 69 73 20 74 72 | 79 69 6e 67 20 74 6f 0d |ho is tr|ying to.|
|00002d80| 0a 74 61 6b 65 20 74 68 | 65 20 6f 62 6a 65 63 74 |.take th|e object|
|00002d90| 20 28 73 69 6e 63 65 20 | 77 65 20 68 61 76 65 20 | (since |we have |
|00002da0| 6e 6f 20 63 68 61 72 61 | 63 74 65 72 73 20 62 65 |no chara|cters be|
|00002db0| 73 69 64 65 73 20 74 68 | 65 20 70 6c 61 79 65 72 |sides th|e player|
|00002dc0| 20 69 6e 20 74 68 69 73 | 20 67 61 6d 65 0d 0a 79 | in this| game..y|
|00002dd0| 65 74 2c 20 7b 5c 74 74 | 20 61 63 74 6f 72 7d 20 |et, {\tt| actor} |
|00002de0| 77 69 6c 6c 20 62 65 20 | 74 68 65 20 70 6c 61 79 |will be |the play|
|00002df0| 65 72 27 73 20 63 68 61 | 72 61 63 74 65 72 2c 20 |er's cha|racter, |
|00002e00| 6e 61 6d 65 64 20 7b 5c | 74 74 20 4d 65 7d 2e 29 |named {\|tt Me}.)|
|00002e10| 20 48 65 72 65 2c 20 77 | 65 27 76 65 0d 0a 73 69 | Here, w|e've..si|
|00002e20| 6d 70 6c 79 20 64 65 66 | 69 6e 65 64 20 69 74 20 |mply def|ined it |
|00002e30| 74 6f 20 64 69 73 70 6c | 61 79 20 61 20 6d 65 73 |to displ|ay a mes|
|00002e40| 73 61 67 65 20 28 73 69 | 6e 63 65 20 74 68 65 20 |sage (si|nce the |
|00002e50| 6d 65 73 73 61 67 65 20 | 69 73 20 65 6e 63 6c 6f |message |is enclo|
|00002e60| 73 65 64 20 69 6e 0d 0a | 64 6f 75 62 6c 65 20 71 |sed in..|double q|
|00002e70| 75 6f 74 65 73 2c 20 69 | 74 20 69 73 20 64 69 73 |uotes, i|t is dis|
|00002e80| 70 6c 61 79 65 64 20 69 | 6d 6d 65 64 69 61 74 65 |played i|mmediate|
|00002e90| 6c 79 20 75 70 6f 6e 20 | 62 65 69 6e 67 20 65 76 |ly upon |being ev|
|00002ea0| 61 6c 75 61 74 65 64 29 | 2c 20 74 68 65 6e 20 63 |aluated)|, then c|
|00002eb0| 61 6c 6c 73 0d 0a 61 20 | 73 70 65 63 69 61 6c 20 |alls..a |special |
|00002ec0| 66 75 6e 63 74 69 6f 6e | 20 63 61 6c 6c 65 64 20 |function| called |
|00002ed0| 7b 5c 74 74 20 64 69 65 | 7d 2e 20 28 54 68 65 20 |{\tt die|}. (The |
|00002ee0| 70 61 72 65 6e 74 68 65 | 73 65 73 20 66 6f 6c 6c |parenthe|ses foll|
|00002ef0| 6f 77 69 6e 67 20 7b 5c | 74 74 20 64 69 65 7d 0d |owing {\|tt die}.|
|00002f00| 0a 74 65 6c 6c 20 54 41 | 44 53 20 74 68 61 74 20 |.tell TA|DS that |
|00002f10| 79 6f 75 20 77 6f 75 6c | 64 20 6c 69 6b 65 20 74 |you woul|d like t|
|00002f20| 6f 20 63 61 6c 6c 20 7b | 5c 74 74 20 64 69 65 7d |o call {|\tt die}|
|00002f30| 20 61 73 20 61 20 66 75 | 6e 63 74 69 6f 6e 2e 29 | as a fu|nction.)|
|00002f40| 0d 0a 0d 0a 59 6f 75 20 | 73 68 6f 75 6c 64 20 6e |....You |should n|
|00002f50| 6f 74 65 20 74 68 61 74 | 20 77 65 20 64 69 64 6e |ote that| we didn|
|00002f60| 27 74 20 6a 75 73 74 20 | 70 69 63 6b 20 74 68 65 |'t just |pick the|
|00002f70| 20 6e 61 6d 65 20 7b 5c | 74 74 20 64 6f 54 61 6b | name {\|tt doTak|
|00002f80| 65 7d 20 6f 75 74 20 6f | 66 20 74 68 69 6e 20 61 |e} out o|f thin a|
|00002f90| 69 72 2e 0d 0a 54 68 65 | 20 7b 5c 74 74 20 64 6f |ir...The| {\tt do|
|00002fa0| 54 61 6b 65 7d 20 6d 65 | 74 68 6f 64 20 69 6e 20 |Take} me|thod in |
|00002fb0| 74 68 65 20 7b 5c 74 74 | 20 67 6f 6c 64 53 6b 75 |the {\tt| goldSku|
|00002fc0| 6c 6c 7d 20 6f 62 6a 65 | 63 74 20 69 73 20 63 61 |ll} obje|ct is ca|
|00002fd0| 6c 6c 65 64 20 62 79 0d | 0a 54 41 44 53 20 77 68 |lled by.|.TADS wh|
|00002fe0| 65 6e 20 74 68 65 20 70 | 6c 61 79 65 72 20 74 79 |en the p|layer ty|
|00002ff0| 70 65 73 20 61 20 60 60 | 74 61 6b 65 22 20 63 6f |pes a ``|take" co|
|00003000| 6d 6d 61 6e 64 20 77 69 | 74 68 20 7b 5c 74 74 20 |mmand wi|th {\tt |
|00003010| 67 6f 6c 64 53 6b 75 6c | 6c 7d 20 61 73 20 74 68 |goldSkul|l} as th|
|00003020| 65 0d 0a 64 69 72 65 63 | 74 20 6f 62 6a 65 63 74 |e..direc|t object|
|00003030| 2e 20 45 61 63 68 20 76 | 65 72 62 20 74 68 65 20 |. Each v|erb the |
|00003040| 70 6c 61 79 65 72 20 74 | 79 70 65 73 20 72 65 73 |player t|ypes res|
|00003050| 75 6c 74 73 20 69 6e 20 | 74 68 65 20 73 79 73 74 |ults in |the syst|
|00003060| 65 6d 20 63 61 6c 6c 69 | 6e 67 0d 0a 70 61 72 74 |em calli|ng..part|
|00003070| 69 63 75 6c 61 72 20 6d | 65 74 68 6f 64 73 20 69 |icular m|ethods i|
|00003080| 6e 20 74 68 65 20 6f 62 | 6a 65 63 74 20 6f 72 20 |n the ob|ject or |
|00003090| 6f 62 6a 65 63 74 73 20 | 6e 61 6d 65 64 20 69 6e |objects |named in|
|000030a0| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 2e 20 54 68 | the com|mand. Th|
|000030b0| 65 0d 0a 6e 61 6d 69 6e | 67 20 6f 66 20 74 68 65 |e..namin|g of the|
|000030c0| 73 65 20 6d 65 74 68 6f | 64 73 20 69 73 20 64 65 |se metho|ds is de|
|000030d0| 73 63 72 69 62 65 64 20 | 69 6e 20 64 65 74 61 69 |scribed |in detai|
|000030e0| 6c 20 6c 61 74 65 72 20 | 69 6e 20 74 68 69 73 20 |l later |in this |
|000030f0| 6d 61 6e 75 61 6c 2e 0d | 0a 0d 0a 59 6f 75 20 6d |manual..|...You m|
|00003100| 69 67 68 74 20 77 6f 6e | 64 65 72 20 77 68 79 20 |ight won|der why |
|00003110| 77 65 20 64 69 64 6e 27 | 74 20 6e 65 65 64 20 61 |we didn'|t need a|
|00003120| 20 7b 5c 74 74 20 64 6f | 54 61 6b 65 7d 20 6d 65 | {\tt do|Take} me|
|00003130| 74 68 6f 64 20 69 6e 20 | 6f 75 72 20 6f 72 69 67 |thod in |our orig|
|00003140| 69 6e 61 6c 0d 0a 64 65 | 66 69 6e 69 74 69 6f 6e |inal..de|finition|
|00003150| 20 6f 66 20 7b 5c 74 74 | 20 67 6f 6c 64 53 6b 75 | of {\tt| goldSku|
|00003160| 6c 6c 7d 2c 0d 0a 6f 72 | 20 79 6f 75 20 6d 69 67 |ll},..or| you mig|
|00003170| 68 74 20 68 61 76 65 20 | 61 73 73 75 6d 65 64 20 |ht have |assumed |
|00003180| 74 68 61 74 20 74 68 65 | 20 73 79 73 74 65 6d 20 |that the| system |
|00003190| 61 75 74 6f 6d 61 74 69 | 63 61 6c 6c 79 20 6b 6e |automati|cally kn|
|000031a0| 6f 77 73 0d 0a 77 68 61 | 74 20 74 6f 20 64 6f 20 |ows..wha|t to do |
|000031b0| 69 66 20 6e 6f 20 7b 5c | 74 74 20 64 6f 54 61 6b |if no {\|tt doTak|
|000031c0| 65 7d 20 69 73 20 64 65 | 66 69 6e 65 64 20 66 6f |e} is de|fined fo|
|000031d0| 72 20 61 6e 20 6f 62 6a | 65 63 74 2e 20 49 6e 20 |r an obj|ect. In |
|000031e0| 66 61 63 74 2c 20 61 6c | 6c 20 6f 62 6a 65 63 74 |fact, al|l object|
|000031f0| 73 0d 0a 64 6f 20 6e 65 | 65 64 20 61 20 7b 5c 74 |s..do ne|ed a {\t|
|00003200| 74 20 64 6f 54 61 6b 65 | 7d 20 6d 65 74 68 6f 64 |t doTake|} method|
|00003210| 2c 20 61 6e 64 20 74 68 | 65 20 73 79 73 74 65 6d |, and th|e system|
|00003220| 20 64 6f 65 73 6e 27 74 | 20 61 75 74 6f 6d 61 74 | doesn't| automat|
|00003230| 69 63 61 6c 6c 79 20 6b | 6e 6f 77 0d 0a 61 6e 79 |ically k|now..any|
|00003240| 74 68 69 6e 67 20 61 62 | 6f 75 74 20 69 74 2e 20 |thing ab|out it. |
|00003250| 20 48 6f 77 65 76 65 72 | 2c 20 73 69 6e 63 65 20 | However|, since |
|00003260| 70 72 61 63 74 69 63 61 | 6c 6c 79 20 65 76 65 72 |practica|lly ever|
|00003270| 79 0d 0a 6f 62 6a 65 63 | 74 20 68 61 73 20 74 68 |y..objec|t has th|
|00003280| 65 20 73 61 6d 65 20 7b | 5c 74 74 20 64 6f 54 61 |e same {|\tt doTa|
|00003290| 6b 65 7d 2c 20 77 69 74 | 68 20 61 20 66 65 77 20 |ke}, wit|h a few |
|000032a0| 65 78 63 65 70 74 69 6f | 6e 73 20 73 75 63 68 20 |exceptio|ns such |
|000032b0| 61 73 0d 0a 7b 5c 74 74 | 20 67 6f 6c 64 53 6b 75 |as..{\tt| goldSku|
|000032c0| 6c 6c 7d 2c 20 69 74 20 | 77 6f 75 6c 64 20 62 65 |ll}, it |would be|
|000032d0| 20 65 78 74 72 65 6d 65 | 6c 79 20 74 65 64 69 6f | extreme|ly tedio|
|000032e0| 75 73 20 74 6f 20 74 79 | 70 65 20 61 0d 0a 7b 5c |us to ty|pe a..{\|
|000032f0| 74 74 20 64 6f 54 61 6b | 65 7d 20 6d 65 74 68 6f |tt doTak|e} metho|
|00003300| 64 20 66 6f 72 20 65 76 | 65 72 79 20 6f 62 6a 65 |d for ev|ery obje|
|00003310| 63 74 20 69 6e 20 74 68 | 65 20 67 61 6d 65 2e 0d |ct in th|e game..|
|00003320| 0a 49 6e 73 74 65 61 64 | 2c 20 77 65 20 75 73 65 |.Instead|, we use|
|00003330| 20 73 6f 6d 65 74 68 69 | 6e 67 20 63 61 6c 6c 65 | somethi|ng calle|
|00003340| 64 20 60 60 5e 7b 69 6e | 68 65 72 69 74 61 6e 63 |d ``^{in|heritanc|
|00003350| 65 7d 2e 22 0d 0a 42 79 | 20 64 65 66 69 6e 69 6e |e}."..By| definin|
|00003360| 67 20 74 68 65 20 7b 5c | 74 74 20 67 6f 6c 64 53 |g the {\|tt goldS|
|00003370| 6b 75 6c 6c 7d 20 74 6f | 20 62 65 20 61 20 6d 65 |kull} to| be a me|
|00003380| 6d 62 65 72 20 6f 66 20 | 74 68 65 20 7b 5c 74 74 |mber of |the {\tt|
|00003390| 20 69 74 65 6d 7d 20 63 | 6c 61 73 73 2c 20 79 6f | item} c|lass, yo|
|000033a0| 75 0d 0a 74 65 6c 6c 20 | 54 41 44 53 20 74 68 61 |u..tell |TADS tha|
|000033b0| 74 20 7b 5c 74 74 20 67 | 6f 6c 64 53 6b 75 6c 6c |t {\tt g|oldSkull|
|000033c0| 7d 20 60 60 69 6e 68 65 | 72 69 74 73 22 20 61 6c |} ``inhe|rits" al|
|000033d0| 6c 20 6f 66 20 74 68 65 | 20 64 65 66 69 6e 69 74 |l of the| definit|
|000033e0| 69 6f 6e 73 20 66 6f 72 | 0d 0a 7b 5c 74 74 20 69 |ions for|..{\tt i|
|000033f0| 74 65 6d 7d 2c 20 69 6e | 20 61 64 64 69 74 69 6f |tem}, in| additio|
|00003400| 6e 20 74 6f 20 61 6e 79 | 20 64 65 66 69 6e 69 74 |n to any| definit|
|00003410| 69 6f 6e 73 20 69 74 20 | 6d 61 6b 65 73 20 6f 6e |ions it |makes on|
|00003420| 20 69 74 73 20 6f 77 6e | 2e 20 54 68 65 20 7b 5c | its own|. The {\|
|00003430| 74 74 20 69 74 65 6d 7d | 0d 0a 63 6c 61 73 73 2c |tt item}|..class,|
|00003440| 20 77 68 69 63 68 20 61 | 70 70 65 61 72 73 20 69 | which a|ppears i|
|00003450| 6e 20 74 68 65 20 7b 5c | 74 74 20 61 64 76 2e 74 |n the {\|tt adv.t|
|00003460| 7d 20 66 69 6c 65 20 69 | 6e 63 6c 75 64 65 64 20 |} file i|ncluded |
|00003470| 61 74 20 74 68 65 20 62 | 65 67 69 6e 6e 69 6e 67 |at the b|eginning|
|00003480| 0d 0a 6f 66 20 74 68 65 | 20 70 72 6f 67 72 61 6d |..of the| program|
|00003490| 2c 20 64 65 66 69 6e 65 | 73 20 61 20 7b 5c 74 74 |, define|s a {\tt|
|000034a0| 20 64 6f 54 61 6b 65 7d | 20 6d 65 74 68 6f 64 2c | doTake}| method,|
|000034b0| 20 73 6f 20 61 6e 79 74 | 68 69 6e 67 20 74 68 61 | so anyt|hing tha|
|000034c0| 74 20 69 73 0d 0a 64 65 | 66 69 6e 65 64 20 74 6f |t is..de|fined to|
|000034d0| 20 62 65 20 61 6e 20 7b | 5c 74 74 20 69 74 65 6d | be an {|\tt item|
|000034e0| 7d 20 69 6e 68 65 72 69 | 74 73 20 74 68 61 74 20 |} inheri|ts that |
|000034f0| 64 65 66 69 6e 69 74 69 | 6f 6e 2e 20 20 48 6f 77 |definiti|on. How|
|00003500| 65 76 65 72 2c 20 69 66 | 20 73 6f 6d 65 74 68 69 |ever, if| somethi|
|00003510| 6e 67 0d 0a 69 73 20 64 | 65 66 69 6e 65 64 20 69 |ng..is d|efined i|
|00003520| 6e 20 62 6f 74 68 20 7b | 5c 74 74 20 69 74 65 6d |n both {|\tt item|
|00003530| 7d 20 61 6e 64 20 7b 5c | 74 74 20 67 6f 6c 64 53 |} and {\|tt goldS|
|00003540| 6b 75 6c 6c 7d 2c 20 61 | 73 20 7b 5c 74 74 20 64 |kull}, a|s {\tt d|
|00003550| 6f 54 61 6b 65 7d 20 69 | 73 20 69 6e 0d 0a 74 68 |oTake} i|s in..th|
|00003560| 69 73 20 65 78 61 6d 70 | 6c 65 2c 20 74 68 65 20 |is examp|le, the |
|00003570| 64 65 66 69 6e 69 74 69 | 6f 6e 20 69 6e 20 7b 5c |definiti|on in {\|
|00003580| 74 74 20 67 6f 6c 64 53 | 6b 75 6c 6c 7d 20 74 61 |tt goldS|kull} ta|
|00003590| 6b 65 73 20 70 72 65 63 | 65 64 65 6e 63 65 2d 2d |kes prec|edence--|
|000035a0| 2d 69 74 0d 0a 60 60 5e | 7b 6f 76 65 72 72 69 64 |-it..``^|{overrid|
|000035b0| 65 73 7d 22 20 74 68 65 | 20 69 6e 68 65 72 69 74 |es}" the| inherit|
|000035c0| 65 64 20 6d 65 74 68 6f | 64 2e 0d 0a 0d 0a 57 65 |ed metho|d.....We|
|000035d0| 20 61 63 74 75 61 6c 6c | 79 20 64 6f 6e 27 74 20 | actuall|y don't |
|000035e0| 68 61 76 65 20 61 20 76 | 65 72 79 20 67 6f 6f 64 |have a v|ery good|
|000035f0| 20 70 75 7a 7a 6c 65 20 | 68 65 72 65 2c 20 62 65 | puzzle |here, be|
|00003600| 63 61 75 73 65 20 74 68 | 65 72 65 27 73 20 6e 6f |cause th|ere's no|
|00003610| 20 77 61 79 20 74 6f 0d | 0a 74 61 6b 65 20 74 68 | way to.|.take th|
|00003620| 65 20 67 6f 6c 64 20 73 | 6b 75 6c 6c 20 77 69 74 |e gold s|kull wit|
|00003630| 68 6f 75 74 20 64 79 69 | 6e 67 2e 20 53 6f 2c 20 |hout dyi|ng. So, |
|00003640| 6c 65 74 27 73 20 70 75 | 74 20 61 20 72 6f 63 6b |let's pu|t a rock|
|00003650| 20 6f 6e 20 74 68 65 20 | 63 61 76 65 20 66 6c 6f | on the |cave flo|
|00003660| 6f 72 3a 0d 0a 0d 0a 7b | 5c 65 78 61 6d 70 6c 65 |or:....{|\example|
|00003670| 0d 0a 20 20 20 20 5c 6f | 62 6a 65 63 74 7b 73 6d |.. \o|bject{sm|
|00003680| 61 6c 6c 52 6f 63 6b 3a | 20 69 74 65 6d 7d 0d 0a |allRock:| item}..|
|00003690| 20 20 20 20 20 20 73 64 | 65 73 63 20 3d 20 22 73 | sd|esc = "s|
|000036a0| 6d 61 6c 6c 20 72 6f 63 | 6b 22 0d 0a 20 20 20 20 |mall roc|k".. |
|000036b0| 20 20 6e 6f 75 6e 20 3d | 20 27 72 6f 63 6b 27 0d | noun =| 'rock'.|
|000036c0| 0a 20 20 20 20 20 20 61 | 64 6a 65 63 74 69 76 65 |. a|djective|
|000036d0| 20 3d 20 27 73 6d 61 6c | 6c 27 0d 0a 20 20 20 20 | = 'smal|l'.. |
|000036e0| 20 20 6c 6f 63 61 74 69 | 6f 6e 20 3d 20 63 61 76 | locati|on = cav|
|000036f0| 65 0d 0a 20 20 20 20 5c | 65 6e 64 6f 62 6a 0d 0a |e.. \|endobj..|
|00003700| 7d 0d 0a 0d 0a 4e 6f 77 | 2c 20 6c 65 74 27 73 20 |}....Now|, let's |
|00003710| 63 68 61 6e 67 65 20 74 | 68 65 20 7b 5c 74 74 20 |change t|he {\tt |
|00003720| 64 6f 54 61 6b 65 7d 20 | 6d 65 74 68 6f 64 20 6f |doTake} |method o|
|00003730| 66 20 74 68 65 20 7b 5c | 74 74 20 67 6f 6c 64 53 |f the {\|tt goldS|
|00003740| 6b 75 6c 6c 7d 2e 0d 0a | 0d 0a 7b 5c 65 78 61 6d |kull}...|..{\exam|
|00003750| 70 6c 65 0d 0a 20 20 20 | 20 64 6f 54 61 6b 65 28 |ple.. | doTake(|
|00003760| 20 61 63 74 6f 72 20 29 | 20 3d 0d 0a 20 20 20 20 | actor )| =.. |
|00003770| 5c 6c 62 0d 0a 20 20 20 | 20 20 20 69 66 20 28 20 |\lb.. | if ( |
|00003780| 73 65 6c 66 2e 6c 6f 63 | 61 74 69 6f 6e 3c 3e 70 |self.loc|ation<>p|
|00003790| 65 64 65 73 74 61 6c 20 | 6f 72 20 20 5c 68 66 69 |edestal |or \hfi|
|000037a0| 6c 6c 20 2f 2a 20 61 6d | 20 49 20 6f 66 66 20 74 |ll /* am| I off t|
|000037b0| 68 65 20 70 65 64 65 73 | 74 61 6c 3f 20 2a 2f 0d |he pedes|tal? */.|
|000037c0| 0a 20 20 20 20 20 20 20 | 73 6d 61 6c 6c 52 6f 63 |. |smallRoc|
|000037d0| 6b 2e 6c 6f 63 61 74 69 | 6f 6e 3d 70 65 64 65 73 |k.locati|on=pedes|
|000037e0| 74 61 6c 20 29 20 20 20 | 5c 68 66 69 6c 6c 20 2f |tal ) |\hfill /|
|000037f0| 2a 20 6f 72 20 69 73 20 | 74 68 65 20 72 6f 63 6b |* or is |the rock|
|00003800| 20 74 68 65 72 65 3f 20 | 2a 2f 0d 0a 20 20 20 20 | there? |*/.. |
|00003810| 20 20 5c 6c 62 0d 0a 20 | 20 20 20 20 20 20 20 20 | \lb.. | |
|00003820| 70 61 73 73 20 64 6f 54 | 61 6b 65 3b 20 20 20 20 |pass doT|ake; |
|00003830| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 5c 68 | | \h|
|00003840| 66 69 6c 6c 20 2f 2a 20 | 79 65 73 20 2d 20 74 61 |fill /* |yes - ta|
|00003850| 6b 65 20 61 73 20 75 73 | 75 61 6c 20 2a 2f 0d 0a |ke as us|ual */..|
|00003860| 20 20 20 20 20 20 5c 72 | 62 0d 0a 20 20 20 20 20 | \r|b.. |
|00003870| 20 65 6c 73 65 20 20 20 | 20 20 20 20 20 20 20 20 | else | |
|00003880| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003890| 20 20 5c 68 66 69 6c 6c | 20 2f 2a 20 6e 6f 20 2d | \hfill| /* no -|
|000038a0| 20 74 68 65 20 74 72 61 | 70 20 67 6f 65 73 20 6f | the tra|p goes o|
|000038b0| 66 66 21 20 2a 2f 20 0d | 0a 20 20 20 20 20 20 5c |ff! */ .|. \|
|000038c0| 6c 62 0d 0a 20 20 20 20 | 20 20 20 20 22 41 73 20 |lb.. | "As |
|000038d0| 79 6f 75 20 6c 69 66 74 | 20 74 68 65 20 73 6b 75 |you lift| the sku|
|000038e0| 6c 6c 2c 20 61 20 76 6f | 6c 6c 65 79 20 6f 66 20 |ll, a vo|lley of |
|000038f0| 70 6f 69 73 6f 6e 6f 75 | 73 0d 0a 09 61 72 72 6f |poisonou|s...arro|
|00003900| 77 73 20 69 73 20 73 68 | 6f 74 20 66 72 6f 6d 20 |ws is sh|ot from |
|00003910| 74 68 65 20 77 61 6c 6c | 73 21 20 59 6f 75 20 74 |the wall|s! You t|
|00003920| 72 79 20 74 6f 20 64 6f | 64 67 65 0d 0a 09 74 68 |ry to do|dge...th|
|00003930| 65 20 61 72 72 6f 77 73 | 2c 20 62 75 74 20 74 68 |e arrows|, but th|
|00003940| 65 79 20 74 61 6b 65 20 | 79 6f 75 20 62 79 20 73 |ey take |you by s|
|00003950| 75 72 70 72 69 73 65 21 | 22 3b 0d 0a 09 64 69 65 |urprise!|";...die|
|00003960| 28 29 3b 0d 0a 20 20 20 | 20 20 20 5c 72 62 0d 0a |();.. | \rb..|
|00003970| 20 20 20 20 5c 72 62 0d | 0a 7d 0d 0a 0d 0a 54 68 | \rb.|.}....Th|
|00003980| 69 73 20 6e 65 77 20 7b | 5c 74 74 20 64 6f 54 61 |is new {|\tt doTa|
|00003990| 6b 65 7d 20 66 69 72 73 | 74 20 63 68 65 63 6b 73 |ke} firs|t checks|
|000039a0| 20 74 6f 20 73 65 65 20 | 69 66 20 74 68 65 20 6f | to see |if the o|
|000039b0| 62 6a 65 63 74 20 62 65 | 69 6e 67 20 74 61 6b 65 |bject be|ing take|
|000039c0| 6e 20 28 74 68 65 0d 0a | 73 70 65 63 69 61 6c 20 |n (the..|special |
|000039d0| 6f 62 6a 65 63 74 20 7b | 5c 74 74 20 73 65 6c 66 |object {|\tt self|
|000039e0| 7d 2c 20 77 68 69 63 68 | 20 69 73 20 74 68 65 20 |}, which| is the |
|000039f0| 6f 62 6a 65 63 74 20 74 | 6f 20 77 68 69 63 68 20 |object t|o which |
|00003a00| 74 68 65 20 6d 65 73 73 | 61 67 65 0d 0a 7b 5c 74 |the mess|age..{\t|
|00003a10| 74 20 64 6f 54 61 6b 65 | 7d 20 77 61 73 20 6f 72 |t doTake|} was or|
|00003a20| 69 67 69 6e 61 6c 6c 79 | 20 73 65 6e 74 29 2c 20 |iginally| sent), |
|00003a30| 77 68 69 63 68 20 69 6e | 20 74 68 69 73 20 63 61 |which in| this ca|
|00003a40| 73 65 20 69 73 20 74 68 | 65 20 67 6f 6c 64 20 73 |se is th|e gold s|
|00003a50| 6b 75 6c 6c 2c 0d 0a 69 | 73 20 61 6c 72 65 61 64 |kull,..i|s alread|
|00003a60| 79 20 6f 66 66 20 74 68 | 65 20 70 65 64 65 73 74 |y off th|e pedest|
|00003a70| 61 6c 3b 20 69 66 20 69 | 74 20 69 73 2c 20 77 65 |al; if i|t is, we|
|00003a80| 20 64 6f 6e 27 74 20 77 | 61 6e 74 20 61 6e 79 74 | don't w|ant anyt|
|00003a90| 68 69 6e 67 20 74 6f 20 | 68 61 70 70 65 6e 2c 0d |hing to |happen,.|
|00003aa0| 0a 73 6f 20 77 65 20 7b | 5c 73 6c 20 70 61 73 73 |.so we {|\sl pass|
|00003ab0| 7d 20 74 68 65 20 7b 5c | 74 74 20 64 6f 54 61 6b |} the {\|tt doTak|
|00003ac0| 65 7d 20 6d 65 73 73 61 | 67 65 2e 20 57 65 20 61 |e} messa|ge. We a|
|00003ad0| 6c 73 6f 20 70 61 73 73 | 20 74 68 65 20 6d 65 73 |lso pass| the mes|
|00003ae0| 73 61 67 65 20 69 66 0d | 0a 74 68 65 20 73 6d 61 |sage if.|.the sma|
|00003af0| 6c 6c 20 72 6f 63 6b 20 | 69 73 20 6f 6e 20 74 68 |ll rock |is on th|
|00003b00| 65 20 70 65 64 65 73 74 | 61 6c 2e 20 57 68 65 6e |e pedest|al. When|
|00003b10| 20 77 65 20 7b 5c 73 6c | 20 70 61 73 73 7d 20 74 | we {\sl| pass} t|
|00003b20| 68 65 20 6d 65 73 73 61 | 67 65 2c 20 74 68 65 0d |he messa|ge, the.|
|00003b30| 0a 7b 5c 74 74 20 64 6f | 54 61 6b 65 7d 20 6d 65 |.{\tt do|Take} me|
|00003b40| 74 68 6f 64 20 74 68 61 | 74 20 77 65 20 69 6e 68 |thod tha|t we inh|
|00003b50| 65 72 69 74 20 66 72 6f | 6d 20 6f 75 72 20 70 61 |erit fro|m our pa|
|00003b60| 72 65 6e 74 20 63 6c 61 | 73 73 20 28 69 6e 20 74 |rent cla|ss (in t|
|00003b70| 68 69 73 20 63 61 73 65 | 2c 0d 0a 7b 5c 74 74 20 |his case|,..{\tt |
|00003b80| 69 74 65 6d 7d 29 20 69 | 73 20 69 6e 76 6f 6b 65 |item}) i|s invoke|
|00003b90| 64 2e 20 54 68 69 73 20 | 61 6c 6c 6f 77 73 20 75 |d. This |allows u|
|00003ba0| 73 20 74 6f 20 6f 76 65 | 72 72 69 64 65 20 61 20 |s to ove|rride a |
|00003bb0| 6d 65 74 68 6f 64 20 6f | 6e 6c 79 20 75 6e 64 65 |method o|nly unde|
|00003bc0| 72 0d 0a 63 65 72 74 61 | 69 6e 20 73 70 65 63 69 |r..certa|in speci|
|00003bd0| 61 6c 20 63 69 72 63 75 | 6d 73 74 61 6e 63 65 73 |al circu|mstances|
|00003be0| 2c 20 61 6e 64 20 6f 74 | 68 65 72 77 69 73 65 20 |, and ot|herwise |
|00003bf0| 64 6f 20 62 75 73 69 6e | 65 73 73 20 61 73 20 75 |do busin|ess as u|
|00003c00| 73 75 61 6c 2e 0d 0a 49 | 66 20 77 65 20 64 6f 6e |sual...I|f we don|
|00003c10| 27 74 20 73 61 74 69 73 | 66 79 20 6f 6e 65 20 6f |'t satis|fy one o|
|00003c20| 66 20 74 68 65 73 65 20 | 74 77 6f 20 72 65 71 75 |f these |two requ|
|00003c30| 69 72 65 6d 65 6e 74 73 | 2c 20 74 68 65 20 76 6f |irements|, the vo|
|00003c40| 6c 6c 65 79 20 6f 66 0d | 0a 70 6f 69 73 6f 6e 6f |lley of.|.poisono|
|00003c50| 75 73 20 61 72 72 6f 77 | 73 20 69 73 20 72 65 6c |us arrow|s is rel|
|00003c60| 65 61 73 65 64 20 61 73 | 20 62 65 66 6f 72 65 2e |eased as| before.|
|00003c70| 0d 0a 0d 0a 53 6f 2c 20 | 74 68 65 20 73 6f 6c 75 |....So, |the solu|
|00003c80| 74 69 6f 6e 20 74 6f 20 | 74 68 65 20 70 75 7a 7a |tion to |the puzz|
|00003c90| 6c 65 20 69 73 20 74 6f | 20 70 75 74 20 74 68 65 |le is to| put the|
|00003ca0| 20 72 6f 63 6b 20 6f 6e | 20 74 68 65 20 70 65 64 | rock on| the ped|
|00003cb0| 65 73 74 61 6c 20 62 65 | 66 6f 72 65 0d 0a 74 61 |estal be|fore..ta|
|00003cc0| 6b 69 6e 67 20 74 68 65 | 20 73 6b 75 6c 6c 2c 20 |king the| skull, |
|00003cd0| 74 68 65 72 65 62 79 20 | 66 6f 6f 6c 69 6e 67 20 |thereby |fooling |
|00003ce0| 74 68 65 20 70 65 64 65 | 73 74 61 6c 20 69 6e 74 |the pede|stal int|
|00003cf0| 6f 20 74 68 69 6e 6b 69 | 6e 67 20 74 68 65 20 73 |o thinki|ng the s|
|00003d00| 6b 75 6c 6c 20 69 73 0d | 0a 73 74 69 6c 6c 20 74 |kull is.|.still t|
|00003d10| 68 65 72 65 2e 0d 0a 0d | 0a 54 68 69 73 20 73 68 |here....|.This sh|
|00003d20| 6f 75 6c 64 20 67 69 76 | 65 20 79 6f 75 20 73 6f |ould giv|e you so|
|00003d30| 6d 65 20 69 64 65 61 20 | 6f 66 20 68 6f 77 20 61 |me idea |of how a|
|00003d40| 20 54 41 44 53 20 70 72 | 6f 67 72 61 6d 20 6c 6f | TADS pr|ogram lo|
|00003d50| 6f 6b 73 2e 20 49 6e 20 | 6c 61 74 65 72 0d 0a 73 |oks. In |later..s|
|00003d60| 65 63 74 69 6f 6e 73 2c | 20 77 65 27 6c 6c 20 63 |ections,| we'll c|
|00003d70| 6f 76 65 72 20 74 68 65 | 20 64 65 74 61 69 6c 73 |over the| details|
|00003d80| 20 6f 66 20 74 68 65 20 | 6c 61 6e 67 75 61 67 65 | of the |language|
|00003d90| 2c 20 61 6e 64 20 65 78 | 70 6c 6f 72 65 0d 0a 61 |, and ex|plore..a|
|00003da0| 6c 6c 20 6f 66 20 74 68 | 65 20 63 6c 61 73 73 65 |ll of th|e classe|
|00003db0| 73 20 64 65 66 69 6e 65 | 64 20 69 6e 20 7b 5c 74 |s define|d in {\t|
|00003dc0| 74 20 61 64 76 2e 74 7d | 2e 20 20 59 6f 75 20 73 |t adv.t}|. You s|
|00003dd0| 68 6f 75 6c 64 20 6e 6f | 74 65 20 74 68 61 74 20 |hould no|te that |
|00003de0| 74 68 65 0d 0a 73 6f 75 | 72 63 65 20 63 6f 64 65 |the..sou|rce code|
|00003df0| 20 74 6f 20 61 20 6d 75 | 63 68 0d 0a 6d 6f 72 65 | to a mu|ch..more|
|00003e00| 20 63 6f 6d 70 6c 65 78 | 20 73 61 6d 70 6c 65 20 | complex| sample |
|00003e10| 67 61 6d 65 20 69 73 20 | 69 6e 63 6c 75 64 65 64 |game is |included|
|00003e20| 20 77 69 74 68 20 74 68 | 65 20 54 41 44 53 20 73 | with th|e TADS s|
|00003e30| 6f 66 74 77 61 72 65 3b | 20 79 6f 75 20 6d 61 79 |oftware;| you may|
|00003e40| 20 66 69 6e 64 0d 0a 69 | 74 20 75 73 65 66 75 6c | find..i|t useful|
|00003e50| 20 74 6f 20 72 65 66 65 | 72 20 74 6f 20 74 68 61 | to refe|r to tha|
|00003e60| 74 20 73 61 6d 70 6c 65 | 20 77 68 69 6c 65 20 72 |t sample| while r|
|00003e70| 65 61 64 69 6e 67 20 74 | 68 65 20 72 65 73 74 20 |eading t|he rest |
|00003e80| 6f 66 20 74 68 69 73 20 | 6d 61 6e 75 61 6c 20 66 |of this |manual f|
|00003e90| 6f 72 0d 0a 65 78 61 6d | 70 6c 65 73 20 6f 66 20 |or..exam|ples of |
|00003ea0| 74 68 65 20 6c 61 6e 67 | 75 61 67 65 20 63 6f 6e |the lang|uage con|
|00003eb0| 73 74 72 75 63 74 73 2e | 20 20 59 6f 75 20 6d 61 |structs.| You ma|
|00003ec0| 79 20 61 6c 73 6f 20 66 | 69 6e 64 20 74 68 61 74 |y also f|ind that|
|00003ed0| 20 70 61 72 74 73 20 6f | 66 20 74 68 65 0d 0a 73 | parts o|f the..s|
|00003ee0| 61 6d 70 6c 65 20 67 61 | 6d 65 20 63 61 6e 20 70 |ample ga|me can p|
|00003ef0| 72 6f 76 69 64 65 20 61 | 20 6d 6f 64 65 6c 20 66 |rovide a| model f|
|00003f00| 6f 72 20 6f 62 6a 65 63 | 74 73 20 69 6e 20 79 6f |or objec|ts in yo|
|00003f10| 75 72 20 6f 77 6e 20 67 | 61 6d 65 73 2e 0d 0a 41 |ur own g|ames...A|
|00003f20| 6c 73 6f 2c 20 6e 6f 74 | 65 20 74 68 61 74 20 63 |lso, not|e that c|
|00003f30| 68 61 70 74 65 72 20 73 | 69 78 20 64 65 73 63 72 |hapter s|ix descr|
|00003f40| 69 62 65 73 20 74 68 65 | 20 69 6d 70 6c 65 6d 65 |ibes the| impleme|
|00003f50| 6e 74 61 74 69 6f 6e 20 | 70 72 6f 63 65 73 73 0d |ntation |process.|
|00003f60| 0a 69 6e 20 73 6f 6d 65 | 77 68 61 74 20 6d 6f 72 |.in some|what mor|
|00003f70| 65 20 64 65 74 61 69 6c | 2c 20 61 6e 64 20 73 68 |e detail|, and sh|
|00003f80| 6f 77 73 20 79 6f 75 20 | 68 6f 77 20 74 6f 20 62 |ows you |how to b|
|00003f90| 75 69 6c 64 20 61 20 6c | 61 72 67 65 72 0d 0a 73 |uild a l|arger..s|
|00003fa0| 61 6d 70 6c 65 20 67 61 | 6d 65 3b 20 79 6f 75 20 |ample ga|me; you |
|00003fb0| 6d 61 79 20 77 61 6e 74 | 20 74 6f 20 6c 6f 6f 6b |may want| to look|
|00003fc0| 20 61 74 20 63 68 61 70 | 74 65 72 20 73 69 78 20 | at chap|ter six |
|00003fd0| 61 66 74 65 72 20 79 6f | 75 27 76 65 0d 0a 62 65 |after yo|u've..be|
|00003fe0| 63 6f 6d 65 20 61 20 6c | 69 74 74 6c 65 20 6d 6f |come a l|ittle mo|
|00003ff0| 72 65 20 66 61 6d 69 6c | 69 61 72 20 77 69 74 68 |re famil|iar with|
|00004000| 20 54 41 44 53 2e 0d 0a | 0d 0a 5c 65 6e 64 63 68 | TADS...|..\endch|
|00004010| 61 70 74 65 72 0d 0a 0d | 0a 45 78 61 6d 70 6c 65 |apter...|.Example|
|00004020| 20 69 73 20 61 6c 77 61 | 79 73 20 6d 6f 72 65 20 | is alwa|ys more |
|00004030| 65 66 66 69 63 61 63 69 | 6f 75 73 20 74 68 61 6e |efficaci|ous than|
|00004040| 20 70 72 65 63 65 70 74 | 2e 0d 0a 5c 61 75 74 68 | precept|...\auth|
|00004050| 6f 72 20 53 41 4d 55 45 | 4c 20 4a 4f 48 4e 53 4f |or SAMUE|L JOHNSO|
|00004060| 4e 2c 20 7b 5c 73 6c 20 | 52 61 73 73 65 6c 61 73 |N, {\sl |Rasselas|
|00004070| 5c 2f 7d 20 28 31 37 35 | 39 29 0d 0a 0d 0a 5c 65 |\/} (175|9)....\e|
|00004080| 6a 65 63 74 0d 0a | |ject.. | |
+--------+-------------------------+-------------------------+--------+--------+